-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first installment of queries + refactor: rename
- Loading branch information
Showing
6 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
services/basket-producer/src/main/java/lrskyum/sbdemo/app/queries/BasketViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package lrskyum.sbdemo.app.queries; | ||
|
||
import lrskyum.sbdemo.business.aggregates.basket.BasketStatus; | ||
import lrskyum.sbdemo.business.aggregates.basket.PaymentMethod; | ||
|
||
import java.time.Instant; | ||
|
||
public class BasketViewModel { | ||
public record BasketDto( | ||
String externalId, | ||
Instant basketDateUtc, | ||
BasketStatus basketStatus, | ||
String buyerName, | ||
PaymentMethod paymentMethod, | ||
String product, | ||
Integer request_count) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
services/basket-producer/src/main/resources/db/changelog/db.changelog-master.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
databaseChangeLog: | ||
- include: | ||
file: db/migrations/001-create-orders.sql | ||
file: db/migrations/001-create-basket.sql | ||
- include: | ||
file: db/migrations/002-query-basket.sql |
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
services/basket-producer/src/main/resources/db/migrations/002-query-basket.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
create materialized view v_basket_request_count as | ||
select b.ext_id, | ||
b.basket_date_utc, | ||
b.basket_status, | ||
b.buyer_name, | ||
b.payment_method, | ||
b.product, | ||
count(cr.ext_id) as request_count | ||
from basket b | ||
left outer join client_request cr | ||
on b.ext_id = cr.ext_id | ||
group by b.ext_id, b.basket_date_utc, b.basket_status, b.buyer_name, b.payment_method, b.product; | ||
|