-
Notifications
You must be signed in to change notification settings - Fork 0
chore: invoice updated #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| <PartnerBalanceCard :balance="partner?.balance ?? 0" /> | ||
|
|
||
| <InvoiceCard | ||
| v-for="invoice in activeInvoices" | ||
| v-for="invoice in invoices" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix potential crash and compatibility: optional chain + avoid
Use a safe fallback and compatible sort: -const invoices = computed(() => partner.value?.invoices.toSorted((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()))
+const invoices = computed(() =>
+ (partner.value?.invoices ?? [])
+ .slice() // clone to avoid mutating store
+ .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()),
+)Also applies to: 31-31 🤖 Prompt for AI Agents |
||
| :key="invoice.id" | ||
| :invoice="invoice" | ||
| /> | ||
|
|
@@ -28,8 +28,7 @@ const { params } = useRoute('partner-id') | |
|
|
||
| const partnerStore = usePartnerStore() | ||
| const partner = computed(() => partnerStore.partners.find((partner) => partner.id === params.id)) | ||
|
|
||
| const activeInvoices = computed(() => partner.value?.invoices) | ||
| const invoices = computed(() => partner.value?.invoices.toSorted((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())) | ||
|
|
||
| const overlay = useOverlay() | ||
| const modalCreateInvoice = overlay.create(ModalCreateInvoice) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,5 +97,10 @@ export type ActivityScheduleTag = 'permanent' | |
| | 'optional' | ||
| | 'advertising' | ||
|
|
||
| export type InvoiceType = 'replenishment' | 'royalties' | 'other' | ||
| export type InvoiceType = 'replenishment' | ||
| | 'royalties' // Роялти | ||
| | 'lump_sum_fee' // Паушальный взнос | ||
| | 'marketing_fee' // Маркетинговый сбор | ||
| | 'rospatent_fee' // Роспатент | ||
| | 'other' | ||
| export type InvoiceStatus = 'paid' | 'unpaid' | ||
|
Comment on lines
+100
to
106
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainEnsure validators/DB constraints accept the new InvoiceType values With new literals added, please verify:
Run to find hard‑coded checks that may need updates: 🏁 Script executed: #!/bin/bash
# Find InvoiceType usages and literal comparisons
rg -nP -C2 "\bInvoiceType\b|invoice\.type\s*[!=]==?\s*['\"][a-z_]+['\"]|['\"](lump_sum_fee|marketing_fee|rospatent_fee)['\"]"Length of output: 3466 🏁 Script executed: #!/bin/bash
# Find DB migrations, enum definitions, and validators
echo "=== DB Migrations and Enum Definitions ==="
fd -t f -e sql -e ts -e js -path "*migration*" . 2>/dev/null | head -20
echo -e "\n=== Zod Validators and Schema Definitions ==="
rg -l "ZodType|z\.enum|z\.literal|validator|schema" --type=ts --type=js packages/ apps/ 2>/dev/null | grep -E "(validator|schema|zod)" | head -20
echo -e "\n=== Enum definitions in database package ==="
rg -nP "enum.*Invoice|InvoiceType.*=" packages/database/ --type=ts
echo -e "\n=== Check constraints in table definitions ==="
rg -nP -A2 -B2 "type.*varchar.*InvoiceType|\.check\(" packages/database/src/tables.tsLength of output: 314 🏁 Script executed: #!/bin/bash
# Find DB migrations, enum definitions, and validators
echo "=== DB Migrations and SQL Definitions ==="
find . -type f \( -name "*migration*" -o -name "*schema*" \) 2>/dev/null | head -20
echo -e "\n=== Zod Validators in packages ==="
rg -l "z\.enum|z\.literal|validator" --type=ts --type=js 2>/dev/null | grep -v node_modules | head -20
echo -e "\n=== Enum or const for InvoiceType ==="
rg -nP "(enum|const).*Invoice" --type=ts 2>/dev/null
echo -e "\n=== DB Table definition with check constraints ==="
rg -nP -A5 "invoices.*table|type.*varchar.*Invoice" packages/database/src/ --type=ts 2>/dev/null | head -30Length of output: 3065 🏁 Script executed: #!/bin/bash
# View the Zod schema definitions for invoices
echo "=== Zod Schema for createPartnerInvoiceSchema ==="
sed -n '55,75p' apps/web-app/shared/services/partner.ts
echo -e "\n=== Zod Schema for updatePartnerInvoiceSchema ==="
sed -n '64,80p' apps/web-app/shared/services/partner.ts
echo -e "\n=== Search for migrations in database package ==="
find packages/database -type f \( -name "*.sql" -o -name "*.ts" -o -name "*.js" \) 2>/dev/null | grep -i migrat
echo -e "\n=== Check for enum() or check constraints in tables.ts ==="
rg -nP "enum\(|\.check\(|values\(" packages/database/src/tables.ts
echo -e "\n=== Full context around invoice table definition ==="
sed -n '790,800p' packages/database/src/tables.tsLength of output: 2324 🏁 Script executed: #!/bin/bash
# Check if type() function has enum validation or if used with enum values
echo "=== Definition of type() helper function ==="
rg -nP "export.*const type|function type" apps/web-app/shared/ --type=ts | head -5
echo -e "\n=== Check partner.ts imports ==="
head -20 apps/web-app/shared/services/partner.ts
echo -e "\n=== Search for any InvoiceType validation in routes ==="
rg -nP "InvoiceType|invoiceType" apps/web-app/server/api/ --type=ts
echo -e "\n=== Check for database schema constraints in SQL or migrations ==="
find packages/database -type f -name "*.sql" 2>/dev/nullLength of output: 1317 🏁 Script executed: #!/bin/bash
# Verify arktype supports literal constraints for enums
echo "=== Full createPartnerInvoiceSchema definition ==="
rg -nP -A15 "export const createPartnerInvoiceSchema" apps/web-app/shared/services/partner.ts
echo -e "\n=== Search for arktype examples with literals in codebase ==="
rg -nP "type\(['\"](.*\s*\|\s*.*)['\"]" apps/web-app/shared/services/ --type=ts | head -10
echo -e "\n=== Check if any schema uses enum patterns ==="
rg -nP "'\w+'\s*\|" apps/web-app/shared/services/partner.ts | head -10Length of output: 2415 Update Arktype validators to enforce new InvoiceType values The invoice schemas in Required fixes:
Additionally, no database-level check constraints were found. Consider adding Drizzle check constraints to the invoices table definition as a secondary validation layer. 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix date‑fns locale import to avoid runtime error
date-fns/locale/ruexports default, not a namedru. Use default import.📝 Committable suggestion
🤖 Prompt for AI Agents