@nuxt-customer-portal/invoices 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +4 -0
  4. package/app/assets/invoices.css +332 -0
  5. package/app/components/InvoicesAdminEmptyState.vue +28 -0
  6. package/app/components/InvoicesAdminInvoices.vue +950 -0
  7. package/app/components/InvoicesAdminListToolbar.vue +19 -0
  8. package/app/components/InvoicesAdminPaginatedList.vue +95 -0
  9. package/app/components/InvoicesClientAccessPanel.vue +63 -0
  10. package/app/components/InvoicesClientSettingsPanel.vue +150 -0
  11. package/app/components/InvoicesDashboardCard.vue +29 -0
  12. package/app/components/InvoicesDashboardReceivedInvoices.vue +1 -0
  13. package/app/components/InvoicesDashboardSalesInvoices.vue +1 -0
  14. package/app/components/InvoicesInvoiceDetail.vue +1109 -0
  15. package/app/components/InvoicesInvoiceEmailModal.vue +223 -0
  16. package/app/components/InvoicesPageShell.vue +7 -0
  17. package/app/components/InvoicesSenderDetailsForm.vue +229 -0
  18. package/app/composables/useInvoiceSources.ts +9 -0
  19. package/app/composables/useInvoices.ts +68 -0
  20. package/app/composables/useInvoicesAdminList.ts +113 -0
  21. package/app/pages/admin/invoices/[id].vue +36 -0
  22. package/app/pages/admin/invoices/index.vue +61 -0
  23. package/app/pages/admin/invoices/new.vue +18 -0
  24. package/app/pages/admin/invoices/settings.vue +86 -0
  25. package/app/pages/invoices/[id].vue +37 -0
  26. package/app/pages/invoices/index.vue +131 -0
  27. package/app/pages/invoices/viewers.vue +115 -0
  28. package/app/plugins/invoices-feature.ts +60 -0
  29. package/i18n/locales/en.json +306 -0
  30. package/i18n/locales/nl.json +306 -0
  31. package/migrations/0000_baseline.sql +235 -0
  32. package/migrations/meta/0000_snapshot.json +1318 -0
  33. package/migrations/meta/_journal.json +13 -0
  34. package/nuxt.config.ts +15 -0
  35. package/package.json +60 -0
  36. package/portal.manifest.mjs +9 -0
  37. package/server/api/invoices/admin/bootstrap.get.ts +17 -0
  38. package/server/api/invoices/admin/clients/[clientId]/access.get.ts +11 -0
  39. package/server/api/invoices/admin/clients/[clientId]/contacts/[id].delete.ts +8 -0
  40. package/server/api/invoices/admin/clients/[clientId]/contacts/[id].patch.ts +13 -0
  41. package/server/api/invoices/admin/clients/[clientId]/contacts/index.get.ts +8 -0
  42. package/server/api/invoices/admin/clients/[clientId]/contacts/index.post.ts +12 -0
  43. package/server/api/invoices/admin/email-domain.get.ts +17 -0
  44. package/server/api/invoices/admin/invoices/[id]/attachments/[attachmentId].delete.ts +23 -0
  45. package/server/api/invoices/admin/invoices/[id]/attachments/[attachmentId].get.ts +30 -0
  46. package/server/api/invoices/admin/invoices/[id]/attachments.post.ts +27 -0
  47. package/server/api/invoices/admin/invoices/[id]/email-preview.get.ts +22 -0
  48. package/server/api/invoices/admin/invoices/[id]/email-status.post.ts +18 -0
  49. package/server/api/invoices/admin/invoices/[id]/email.post.ts +24 -0
  50. package/server/api/invoices/admin/invoices/[id]/index.get.ts +17 -0
  51. package/server/api/invoices/admin/invoices/[id]/issue.post.ts +24 -0
  52. package/server/api/invoices/admin/invoices/[id]/payments.post.ts +24 -0
  53. package/server/api/invoices/admin/invoices/[id]/pdf.get.ts +29 -0
  54. package/server/api/invoices/admin/invoices/[id]/reminder-preview.get.ts +24 -0
  55. package/server/api/invoices/admin/invoices/[id]/reminder.post.ts +25 -0
  56. package/server/api/invoices/admin/invoices/[id].patch.ts +24 -0
  57. package/server/api/invoices/admin/invoices/index.get.ts +20 -0
  58. package/server/api/invoices/admin/invoices/index.post.ts +19 -0
  59. package/server/api/invoices/admin/invoices/next-number.get.ts +16 -0
  60. package/server/api/invoices/admin/settings.put.ts +9 -0
  61. package/server/api/invoices/capabilities.get.ts +25 -0
  62. package/server/api/invoices/client/[accessId]/viewers.get.ts +10 -0
  63. package/server/api/invoices/client/[accessId]/viewers.put.ts +17 -0
  64. package/server/api/invoices/client/invoices/[id]/attachments/[attachmentId].get.ts +20 -0
  65. package/server/api/invoices/client/invoices/[id]/index.get.ts +12 -0
  66. package/server/api/invoices/client/invoices/[id]/pdf.get.ts +23 -0
  67. package/server/api/invoices/client/invoices/index.get.ts +14 -0
  68. package/server/api/invoices/client/suppliers.get.ts +8 -0
  69. package/server/db/schema/invoices.ts +251 -0
  70. package/server/plugins/openapi-contracts.ts +55 -0
  71. package/server/utils/invoice-email-status.ts +64 -0
  72. package/server/utils/invoice-email.ts +240 -0
  73. package/server/utils/invoice-listing.ts +71 -0
  74. package/server/utils/invoice-pdf.ts +358 -0
  75. package/server/utils/invoice-repository.ts +821 -0
  76. package/server/utils/invoice-validation.ts +112 -0
  77. package/shared/email-delivery-status.ts +23 -0
  78. package/shared/feature.ts +148 -0
  79. package/shared/invoice-introduction.ts +21 -0
  80. package/shared/invoice-number.ts +24 -0
  81. package/shared/types/invoice.ts +251 -0
  82. package/tokens.css +25 -0
@@ -0,0 +1,1318 @@
1
+ {
2
+ "id": "c341418c-aaca-4a59-96a9-8beaae897add",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "invoices.billing_contact": {
8
+ "name": "billing_contact",
9
+ "schema": "invoices",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "organization_id": {
18
+ "name": "organization_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "user_id": {
24
+ "name": "user_id",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": false
28
+ },
29
+ "name": {
30
+ "name": "name",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "email": {
36
+ "name": "email",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "phone": {
42
+ "name": "phone",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": false
46
+ },
47
+ "job_title": {
48
+ "name": "job_title",
49
+ "type": "text",
50
+ "primaryKey": false,
51
+ "notNull": false
52
+ },
53
+ "created_at": {
54
+ "name": "created_at",
55
+ "type": "timestamp",
56
+ "primaryKey": false,
57
+ "notNull": true,
58
+ "default": "now()"
59
+ },
60
+ "updated_at": {
61
+ "name": "updated_at",
62
+ "type": "timestamp",
63
+ "primaryKey": false,
64
+ "notNull": true,
65
+ "default": "now()"
66
+ }
67
+ },
68
+ "indexes": {
69
+ "billing_contact_org_email_uidx": {
70
+ "name": "billing_contact_org_email_uidx",
71
+ "columns": [
72
+ {
73
+ "expression": "organization_id",
74
+ "isExpression": false,
75
+ "asc": true,
76
+ "nulls": "last"
77
+ },
78
+ {
79
+ "expression": "email",
80
+ "isExpression": false,
81
+ "asc": true,
82
+ "nulls": "last"
83
+ }
84
+ ],
85
+ "isUnique": true,
86
+ "concurrently": false,
87
+ "method": "btree",
88
+ "with": {}
89
+ },
90
+ "billing_contact_org_idx": {
91
+ "name": "billing_contact_org_idx",
92
+ "columns": [
93
+ {
94
+ "expression": "organization_id",
95
+ "isExpression": false,
96
+ "asc": true,
97
+ "nulls": "last"
98
+ }
99
+ ],
100
+ "isUnique": false,
101
+ "concurrently": false,
102
+ "method": "btree",
103
+ "with": {}
104
+ }
105
+ },
106
+ "foreignKeys": {
107
+ "billing_contact_organization_id_organization_id_fk": {
108
+ "name": "billing_contact_organization_id_organization_id_fk",
109
+ "tableFrom": "billing_contact",
110
+ "tableTo": "organization",
111
+ "columnsFrom": ["organization_id"],
112
+ "columnsTo": ["id"],
113
+ "onDelete": "cascade",
114
+ "onUpdate": "no action"
115
+ },
116
+ "billing_contact_user_id_user_id_fk": {
117
+ "name": "billing_contact_user_id_user_id_fk",
118
+ "tableFrom": "billing_contact",
119
+ "tableTo": "user",
120
+ "columnsFrom": ["user_id"],
121
+ "columnsTo": ["id"],
122
+ "onDelete": "set null",
123
+ "onUpdate": "no action"
124
+ }
125
+ },
126
+ "compositePrimaryKeys": {},
127
+ "uniqueConstraints": {},
128
+ "policies": {},
129
+ "checkConstraints": {},
130
+ "isRLSEnabled": false
131
+ },
132
+ "invoices.invoice": {
133
+ "name": "invoice",
134
+ "schema": "invoices",
135
+ "columns": {
136
+ "id": {
137
+ "name": "id",
138
+ "type": "text",
139
+ "primaryKey": true,
140
+ "notNull": true
141
+ },
142
+ "organization_id": {
143
+ "name": "organization_id",
144
+ "type": "text",
145
+ "primaryKey": false,
146
+ "notNull": true
147
+ },
148
+ "client_organization_id": {
149
+ "name": "client_organization_id",
150
+ "type": "text",
151
+ "primaryKey": false,
152
+ "notNull": false
153
+ },
154
+ "number": {
155
+ "name": "number",
156
+ "type": "text",
157
+ "primaryKey": false,
158
+ "notNull": true
159
+ },
160
+ "status": {
161
+ "name": "status",
162
+ "type": "invoice_status",
163
+ "typeSchema": "invoices",
164
+ "primaryKey": false,
165
+ "notNull": true,
166
+ "default": "'DRAFT'"
167
+ },
168
+ "currency": {
169
+ "name": "currency",
170
+ "type": "text",
171
+ "primaryKey": false,
172
+ "notNull": true
173
+ },
174
+ "issue_date": {
175
+ "name": "issue_date",
176
+ "type": "date",
177
+ "primaryKey": false,
178
+ "notNull": true
179
+ },
180
+ "due_date": {
181
+ "name": "due_date",
182
+ "type": "date",
183
+ "primaryKey": false,
184
+ "notNull": true
185
+ },
186
+ "subject": {
187
+ "name": "subject",
188
+ "type": "text",
189
+ "primaryKey": false,
190
+ "notNull": false
191
+ },
192
+ "notes": {
193
+ "name": "notes",
194
+ "type": "text",
195
+ "primaryKey": false,
196
+ "notNull": false
197
+ },
198
+ "sender_name": {
199
+ "name": "sender_name",
200
+ "type": "text",
201
+ "primaryKey": false,
202
+ "notNull": true
203
+ },
204
+ "sender_logo": {
205
+ "name": "sender_logo",
206
+ "type": "text",
207
+ "primaryKey": false,
208
+ "notNull": false
209
+ },
210
+ "sender_address": {
211
+ "name": "sender_address",
212
+ "type": "text",
213
+ "primaryKey": false,
214
+ "notNull": true
215
+ },
216
+ "sender_registration": {
217
+ "name": "sender_registration",
218
+ "type": "text",
219
+ "primaryKey": false,
220
+ "notNull": false
221
+ },
222
+ "sender_vat_number": {
223
+ "name": "sender_vat_number",
224
+ "type": "text",
225
+ "primaryKey": false,
226
+ "notNull": false
227
+ },
228
+ "sender_iban": {
229
+ "name": "sender_iban",
230
+ "type": "text",
231
+ "primaryKey": false,
232
+ "notNull": false
233
+ },
234
+ "sender_bic": {
235
+ "name": "sender_bic",
236
+ "type": "text",
237
+ "primaryKey": false,
238
+ "notNull": false
239
+ },
240
+ "recipient_name": {
241
+ "name": "recipient_name",
242
+ "type": "text",
243
+ "primaryKey": false,
244
+ "notNull": true
245
+ },
246
+ "recipient_address": {
247
+ "name": "recipient_address",
248
+ "type": "text",
249
+ "primaryKey": false,
250
+ "notNull": true
251
+ },
252
+ "recipient_contact_name": {
253
+ "name": "recipient_contact_name",
254
+ "type": "text",
255
+ "primaryKey": false,
256
+ "notNull": false
257
+ },
258
+ "recipient_email": {
259
+ "name": "recipient_email",
260
+ "type": "text",
261
+ "primaryKey": false,
262
+ "notNull": false
263
+ },
264
+ "recipient_locale": {
265
+ "name": "recipient_locale",
266
+ "type": "text",
267
+ "primaryKey": false,
268
+ "notNull": true,
269
+ "default": "'nl'"
270
+ },
271
+ "created_by_id": {
272
+ "name": "created_by_id",
273
+ "type": "text",
274
+ "primaryKey": false,
275
+ "notNull": true
276
+ },
277
+ "issued_at": {
278
+ "name": "issued_at",
279
+ "type": "timestamp",
280
+ "primaryKey": false,
281
+ "notNull": false
282
+ },
283
+ "created_at": {
284
+ "name": "created_at",
285
+ "type": "timestamp",
286
+ "primaryKey": false,
287
+ "notNull": true,
288
+ "default": "now()"
289
+ },
290
+ "updated_at": {
291
+ "name": "updated_at",
292
+ "type": "timestamp",
293
+ "primaryKey": false,
294
+ "notNull": true,
295
+ "default": "now()"
296
+ }
297
+ },
298
+ "indexes": {
299
+ "invoice_org_number_uidx": {
300
+ "name": "invoice_org_number_uidx",
301
+ "columns": [
302
+ {
303
+ "expression": "organization_id",
304
+ "isExpression": false,
305
+ "asc": true,
306
+ "nulls": "last"
307
+ },
308
+ {
309
+ "expression": "number",
310
+ "isExpression": false,
311
+ "asc": true,
312
+ "nulls": "last"
313
+ }
314
+ ],
315
+ "isUnique": true,
316
+ "concurrently": false,
317
+ "method": "btree",
318
+ "with": {}
319
+ },
320
+ "invoice_org_status_idx": {
321
+ "name": "invoice_org_status_idx",
322
+ "columns": [
323
+ {
324
+ "expression": "organization_id",
325
+ "isExpression": false,
326
+ "asc": true,
327
+ "nulls": "last"
328
+ },
329
+ {
330
+ "expression": "status",
331
+ "isExpression": false,
332
+ "asc": true,
333
+ "nulls": "last"
334
+ }
335
+ ],
336
+ "isUnique": false,
337
+ "concurrently": false,
338
+ "method": "btree",
339
+ "with": {}
340
+ },
341
+ "invoice_client_idx": {
342
+ "name": "invoice_client_idx",
343
+ "columns": [
344
+ {
345
+ "expression": "client_organization_id",
346
+ "isExpression": false,
347
+ "asc": true,
348
+ "nulls": "last"
349
+ }
350
+ ],
351
+ "isUnique": false,
352
+ "concurrently": false,
353
+ "method": "btree",
354
+ "with": {}
355
+ }
356
+ },
357
+ "foreignKeys": {
358
+ "invoice_organization_id_organization_id_fk": {
359
+ "name": "invoice_organization_id_organization_id_fk",
360
+ "tableFrom": "invoice",
361
+ "tableTo": "organization",
362
+ "columnsFrom": ["organization_id"],
363
+ "columnsTo": ["id"],
364
+ "onDelete": "cascade",
365
+ "onUpdate": "no action"
366
+ },
367
+ "invoice_client_organization_id_organization_id_fk": {
368
+ "name": "invoice_client_organization_id_organization_id_fk",
369
+ "tableFrom": "invoice",
370
+ "tableTo": "organization",
371
+ "columnsFrom": ["client_organization_id"],
372
+ "columnsTo": ["id"],
373
+ "onDelete": "restrict",
374
+ "onUpdate": "no action"
375
+ },
376
+ "invoice_created_by_id_user_id_fk": {
377
+ "name": "invoice_created_by_id_user_id_fk",
378
+ "tableFrom": "invoice",
379
+ "tableTo": "user",
380
+ "columnsFrom": ["created_by_id"],
381
+ "columnsTo": ["id"],
382
+ "onDelete": "restrict",
383
+ "onUpdate": "no action"
384
+ }
385
+ },
386
+ "compositePrimaryKeys": {},
387
+ "uniqueConstraints": {},
388
+ "policies": {},
389
+ "checkConstraints": {},
390
+ "isRLSEnabled": false
391
+ },
392
+ "invoices.invoice_attachment": {
393
+ "name": "invoice_attachment",
394
+ "schema": "invoices",
395
+ "columns": {
396
+ "id": {
397
+ "name": "id",
398
+ "type": "text",
399
+ "primaryKey": true,
400
+ "notNull": true
401
+ },
402
+ "invoice_id": {
403
+ "name": "invoice_id",
404
+ "type": "text",
405
+ "primaryKey": false,
406
+ "notNull": true
407
+ },
408
+ "file_name": {
409
+ "name": "file_name",
410
+ "type": "text",
411
+ "primaryKey": false,
412
+ "notNull": true
413
+ },
414
+ "content_type": {
415
+ "name": "content_type",
416
+ "type": "text",
417
+ "primaryKey": false,
418
+ "notNull": true
419
+ },
420
+ "size": {
421
+ "name": "size",
422
+ "type": "integer",
423
+ "primaryKey": false,
424
+ "notNull": true
425
+ },
426
+ "content_base64": {
427
+ "name": "content_base64",
428
+ "type": "text",
429
+ "primaryKey": false,
430
+ "notNull": true
431
+ },
432
+ "uploaded_by_id": {
433
+ "name": "uploaded_by_id",
434
+ "type": "text",
435
+ "primaryKey": false,
436
+ "notNull": true
437
+ },
438
+ "created_at": {
439
+ "name": "created_at",
440
+ "type": "timestamp",
441
+ "primaryKey": false,
442
+ "notNull": true,
443
+ "default": "now()"
444
+ }
445
+ },
446
+ "indexes": {
447
+ "invoice_attachment_invoice_idx": {
448
+ "name": "invoice_attachment_invoice_idx",
449
+ "columns": [
450
+ {
451
+ "expression": "invoice_id",
452
+ "isExpression": false,
453
+ "asc": true,
454
+ "nulls": "last"
455
+ }
456
+ ],
457
+ "isUnique": false,
458
+ "concurrently": false,
459
+ "method": "btree",
460
+ "with": {}
461
+ }
462
+ },
463
+ "foreignKeys": {
464
+ "invoice_attachment_invoice_id_invoice_id_fk": {
465
+ "name": "invoice_attachment_invoice_id_invoice_id_fk",
466
+ "tableFrom": "invoice_attachment",
467
+ "tableTo": "invoice",
468
+ "schemaTo": "invoices",
469
+ "columnsFrom": ["invoice_id"],
470
+ "columnsTo": ["id"],
471
+ "onDelete": "cascade",
472
+ "onUpdate": "no action"
473
+ },
474
+ "invoice_attachment_uploaded_by_id_user_id_fk": {
475
+ "name": "invoice_attachment_uploaded_by_id_user_id_fk",
476
+ "tableFrom": "invoice_attachment",
477
+ "tableTo": "user",
478
+ "columnsFrom": ["uploaded_by_id"],
479
+ "columnsTo": ["id"],
480
+ "onDelete": "restrict",
481
+ "onUpdate": "no action"
482
+ }
483
+ },
484
+ "compositePrimaryKeys": {},
485
+ "uniqueConstraints": {},
486
+ "policies": {},
487
+ "checkConstraints": {},
488
+ "isRLSEnabled": false
489
+ },
490
+ "invoices.client_access": {
491
+ "name": "client_access",
492
+ "schema": "invoices",
493
+ "columns": {
494
+ "id": {
495
+ "name": "id",
496
+ "type": "text",
497
+ "primaryKey": true,
498
+ "notNull": true
499
+ },
500
+ "provider_organization_id": {
501
+ "name": "provider_organization_id",
502
+ "type": "text",
503
+ "primaryKey": false,
504
+ "notNull": true
505
+ },
506
+ "client_organization_id": {
507
+ "name": "client_organization_id",
508
+ "type": "text",
509
+ "primaryKey": false,
510
+ "notNull": true
511
+ },
512
+ "enabled": {
513
+ "name": "enabled",
514
+ "type": "boolean",
515
+ "primaryKey": false,
516
+ "notNull": true,
517
+ "default": true
518
+ },
519
+ "created_at": {
520
+ "name": "created_at",
521
+ "type": "timestamp",
522
+ "primaryKey": false,
523
+ "notNull": true,
524
+ "default": "now()"
525
+ },
526
+ "updated_at": {
527
+ "name": "updated_at",
528
+ "type": "timestamp",
529
+ "primaryKey": false,
530
+ "notNull": true,
531
+ "default": "now()"
532
+ }
533
+ },
534
+ "indexes": {
535
+ "invoice_client_access_provider_client_uidx": {
536
+ "name": "invoice_client_access_provider_client_uidx",
537
+ "columns": [
538
+ {
539
+ "expression": "provider_organization_id",
540
+ "isExpression": false,
541
+ "asc": true,
542
+ "nulls": "last"
543
+ },
544
+ {
545
+ "expression": "client_organization_id",
546
+ "isExpression": false,
547
+ "asc": true,
548
+ "nulls": "last"
549
+ }
550
+ ],
551
+ "isUnique": true,
552
+ "concurrently": false,
553
+ "method": "btree",
554
+ "with": {}
555
+ },
556
+ "invoice_client_access_client_idx": {
557
+ "name": "invoice_client_access_client_idx",
558
+ "columns": [
559
+ {
560
+ "expression": "client_organization_id",
561
+ "isExpression": false,
562
+ "asc": true,
563
+ "nulls": "last"
564
+ }
565
+ ],
566
+ "isUnique": false,
567
+ "concurrently": false,
568
+ "method": "btree",
569
+ "with": {}
570
+ }
571
+ },
572
+ "foreignKeys": {
573
+ "client_access_provider_organization_id_organization_id_fk": {
574
+ "name": "client_access_provider_organization_id_organization_id_fk",
575
+ "tableFrom": "client_access",
576
+ "tableTo": "organization",
577
+ "columnsFrom": ["provider_organization_id"],
578
+ "columnsTo": ["id"],
579
+ "onDelete": "cascade",
580
+ "onUpdate": "no action"
581
+ },
582
+ "client_access_client_organization_id_organization_id_fk": {
583
+ "name": "client_access_client_organization_id_organization_id_fk",
584
+ "tableFrom": "client_access",
585
+ "tableTo": "organization",
586
+ "columnsFrom": ["client_organization_id"],
587
+ "columnsTo": ["id"],
588
+ "onDelete": "restrict",
589
+ "onUpdate": "no action"
590
+ }
591
+ },
592
+ "compositePrimaryKeys": {},
593
+ "uniqueConstraints": {},
594
+ "policies": {},
595
+ "checkConstraints": {},
596
+ "isRLSEnabled": false
597
+ },
598
+ "invoices.client_viewer": {
599
+ "name": "client_viewer",
600
+ "schema": "invoices",
601
+ "columns": {
602
+ "id": {
603
+ "name": "id",
604
+ "type": "text",
605
+ "primaryKey": true,
606
+ "notNull": true
607
+ },
608
+ "access_id": {
609
+ "name": "access_id",
610
+ "type": "text",
611
+ "primaryKey": false,
612
+ "notNull": true
613
+ },
614
+ "user_id": {
615
+ "name": "user_id",
616
+ "type": "text",
617
+ "primaryKey": false,
618
+ "notNull": true
619
+ },
620
+ "created_by_id": {
621
+ "name": "created_by_id",
622
+ "type": "text",
623
+ "primaryKey": false,
624
+ "notNull": true
625
+ },
626
+ "created_at": {
627
+ "name": "created_at",
628
+ "type": "timestamp",
629
+ "primaryKey": false,
630
+ "notNull": true,
631
+ "default": "now()"
632
+ }
633
+ },
634
+ "indexes": {
635
+ "invoice_client_viewer_access_user_uidx": {
636
+ "name": "invoice_client_viewer_access_user_uidx",
637
+ "columns": [
638
+ {
639
+ "expression": "access_id",
640
+ "isExpression": false,
641
+ "asc": true,
642
+ "nulls": "last"
643
+ },
644
+ {
645
+ "expression": "user_id",
646
+ "isExpression": false,
647
+ "asc": true,
648
+ "nulls": "last"
649
+ }
650
+ ],
651
+ "isUnique": true,
652
+ "concurrently": false,
653
+ "method": "btree",
654
+ "with": {}
655
+ },
656
+ "invoice_client_viewer_user_idx": {
657
+ "name": "invoice_client_viewer_user_idx",
658
+ "columns": [
659
+ {
660
+ "expression": "user_id",
661
+ "isExpression": false,
662
+ "asc": true,
663
+ "nulls": "last"
664
+ }
665
+ ],
666
+ "isUnique": false,
667
+ "concurrently": false,
668
+ "method": "btree",
669
+ "with": {}
670
+ }
671
+ },
672
+ "foreignKeys": {
673
+ "client_viewer_access_id_client_access_id_fk": {
674
+ "name": "client_viewer_access_id_client_access_id_fk",
675
+ "tableFrom": "client_viewer",
676
+ "tableTo": "client_access",
677
+ "schemaTo": "invoices",
678
+ "columnsFrom": ["access_id"],
679
+ "columnsTo": ["id"],
680
+ "onDelete": "cascade",
681
+ "onUpdate": "no action"
682
+ },
683
+ "client_viewer_user_id_user_id_fk": {
684
+ "name": "client_viewer_user_id_user_id_fk",
685
+ "tableFrom": "client_viewer",
686
+ "tableTo": "user",
687
+ "columnsFrom": ["user_id"],
688
+ "columnsTo": ["id"],
689
+ "onDelete": "cascade",
690
+ "onUpdate": "no action"
691
+ },
692
+ "client_viewer_created_by_id_user_id_fk": {
693
+ "name": "client_viewer_created_by_id_user_id_fk",
694
+ "tableFrom": "client_viewer",
695
+ "tableTo": "user",
696
+ "columnsFrom": ["created_by_id"],
697
+ "columnsTo": ["id"],
698
+ "onDelete": "restrict",
699
+ "onUpdate": "no action"
700
+ }
701
+ },
702
+ "compositePrimaryKeys": {},
703
+ "uniqueConstraints": {},
704
+ "policies": {},
705
+ "checkConstraints": {},
706
+ "isRLSEnabled": false
707
+ },
708
+ "invoices.invoice_email_delivery": {
709
+ "name": "invoice_email_delivery",
710
+ "schema": "invoices",
711
+ "columns": {
712
+ "id": {
713
+ "name": "id",
714
+ "type": "text",
715
+ "primaryKey": true,
716
+ "notNull": true
717
+ },
718
+ "invoice_id": {
719
+ "name": "invoice_id",
720
+ "type": "text",
721
+ "primaryKey": false,
722
+ "notNull": true
723
+ },
724
+ "status": {
725
+ "name": "status",
726
+ "type": "invoice_email_delivery_status",
727
+ "typeSchema": "invoices",
728
+ "primaryKey": false,
729
+ "notNull": true,
730
+ "default": "'PENDING'"
731
+ },
732
+ "purpose": {
733
+ "name": "purpose",
734
+ "type": "invoice_email_purpose",
735
+ "typeSchema": "invoices",
736
+ "primaryKey": false,
737
+ "notNull": true,
738
+ "default": "'INVOICE'"
739
+ },
740
+ "recipient_email": {
741
+ "name": "recipient_email",
742
+ "type": "text",
743
+ "primaryKey": false,
744
+ "notNull": true
745
+ },
746
+ "cc_emails": {
747
+ "name": "cc_emails",
748
+ "type": "text",
749
+ "primaryKey": false,
750
+ "notNull": true,
751
+ "default": "'[]'"
752
+ },
753
+ "locale": {
754
+ "name": "locale",
755
+ "type": "text",
756
+ "primaryKey": false,
757
+ "notNull": true
758
+ },
759
+ "subject": {
760
+ "name": "subject",
761
+ "type": "text",
762
+ "primaryKey": false,
763
+ "notNull": true
764
+ },
765
+ "body": {
766
+ "name": "body",
767
+ "type": "text",
768
+ "primaryKey": false,
769
+ "notNull": true
770
+ },
771
+ "actor_user_id": {
772
+ "name": "actor_user_id",
773
+ "type": "text",
774
+ "primaryKey": false,
775
+ "notNull": true
776
+ },
777
+ "provider_message_id": {
778
+ "name": "provider_message_id",
779
+ "type": "text",
780
+ "primaryKey": false,
781
+ "notNull": false
782
+ },
783
+ "provider_last_event": {
784
+ "name": "provider_last_event",
785
+ "type": "text",
786
+ "primaryKey": false,
787
+ "notNull": false
788
+ },
789
+ "provider_status_checked_at": {
790
+ "name": "provider_status_checked_at",
791
+ "type": "timestamp",
792
+ "primaryKey": false,
793
+ "notNull": false
794
+ },
795
+ "error_message": {
796
+ "name": "error_message",
797
+ "type": "text",
798
+ "primaryKey": false,
799
+ "notNull": false
800
+ },
801
+ "payload_hash": {
802
+ "name": "payload_hash",
803
+ "type": "text",
804
+ "primaryKey": false,
805
+ "notNull": true
806
+ },
807
+ "created_at": {
808
+ "name": "created_at",
809
+ "type": "timestamp",
810
+ "primaryKey": false,
811
+ "notNull": true,
812
+ "default": "now()"
813
+ },
814
+ "updated_at": {
815
+ "name": "updated_at",
816
+ "type": "timestamp",
817
+ "primaryKey": false,
818
+ "notNull": true,
819
+ "default": "now()"
820
+ },
821
+ "sent_at": {
822
+ "name": "sent_at",
823
+ "type": "timestamp",
824
+ "primaryKey": false,
825
+ "notNull": false
826
+ }
827
+ },
828
+ "indexes": {
829
+ "invoice_email_delivery_invoice_idx": {
830
+ "name": "invoice_email_delivery_invoice_idx",
831
+ "columns": [
832
+ {
833
+ "expression": "invoice_id",
834
+ "isExpression": false,
835
+ "asc": true,
836
+ "nulls": "last"
837
+ },
838
+ {
839
+ "expression": "created_at",
840
+ "isExpression": false,
841
+ "asc": true,
842
+ "nulls": "last"
843
+ }
844
+ ],
845
+ "isUnique": false,
846
+ "concurrently": false,
847
+ "method": "btree",
848
+ "with": {}
849
+ },
850
+ "invoice_email_delivery_pending_invoice_uidx": {
851
+ "name": "invoice_email_delivery_pending_invoice_uidx",
852
+ "columns": [
853
+ {
854
+ "expression": "invoice_id",
855
+ "isExpression": false,
856
+ "asc": true,
857
+ "nulls": "last"
858
+ }
859
+ ],
860
+ "isUnique": true,
861
+ "where": "\"invoices\".\"invoice_email_delivery\".\"status\" = 'PENDING'",
862
+ "concurrently": false,
863
+ "method": "btree",
864
+ "with": {}
865
+ }
866
+ },
867
+ "foreignKeys": {
868
+ "invoice_email_delivery_invoice_id_invoice_id_fk": {
869
+ "name": "invoice_email_delivery_invoice_id_invoice_id_fk",
870
+ "tableFrom": "invoice_email_delivery",
871
+ "tableTo": "invoice",
872
+ "schemaTo": "invoices",
873
+ "columnsFrom": ["invoice_id"],
874
+ "columnsTo": ["id"],
875
+ "onDelete": "cascade",
876
+ "onUpdate": "no action"
877
+ },
878
+ "invoice_email_delivery_actor_user_id_user_id_fk": {
879
+ "name": "invoice_email_delivery_actor_user_id_user_id_fk",
880
+ "tableFrom": "invoice_email_delivery",
881
+ "tableTo": "user",
882
+ "columnsFrom": ["actor_user_id"],
883
+ "columnsTo": ["id"],
884
+ "onDelete": "restrict",
885
+ "onUpdate": "no action"
886
+ }
887
+ },
888
+ "compositePrimaryKeys": {},
889
+ "uniqueConstraints": {},
890
+ "policies": {},
891
+ "checkConstraints": {},
892
+ "isRLSEnabled": false
893
+ },
894
+ "invoices.invoice_history": {
895
+ "name": "invoice_history",
896
+ "schema": "invoices",
897
+ "columns": {
898
+ "id": {
899
+ "name": "id",
900
+ "type": "text",
901
+ "primaryKey": true,
902
+ "notNull": true
903
+ },
904
+ "invoice_id": {
905
+ "name": "invoice_id",
906
+ "type": "text",
907
+ "primaryKey": false,
908
+ "notNull": true
909
+ },
910
+ "action": {
911
+ "name": "action",
912
+ "type": "text",
913
+ "primaryKey": false,
914
+ "notNull": true
915
+ },
916
+ "actor_user_id": {
917
+ "name": "actor_user_id",
918
+ "type": "text",
919
+ "primaryKey": false,
920
+ "notNull": true
921
+ },
922
+ "amount_minor": {
923
+ "name": "amount_minor",
924
+ "type": "integer",
925
+ "primaryKey": false,
926
+ "notNull": false
927
+ },
928
+ "attachment_name": {
929
+ "name": "attachment_name",
930
+ "type": "text",
931
+ "primaryKey": false,
932
+ "notNull": false
933
+ },
934
+ "created_at": {
935
+ "name": "created_at",
936
+ "type": "timestamp",
937
+ "primaryKey": false,
938
+ "notNull": true,
939
+ "default": "now()"
940
+ }
941
+ },
942
+ "indexes": {
943
+ "invoice_history_invoice_idx": {
944
+ "name": "invoice_history_invoice_idx",
945
+ "columns": [
946
+ {
947
+ "expression": "invoice_id",
948
+ "isExpression": false,
949
+ "asc": true,
950
+ "nulls": "last"
951
+ }
952
+ ],
953
+ "isUnique": false,
954
+ "concurrently": false,
955
+ "method": "btree",
956
+ "with": {}
957
+ }
958
+ },
959
+ "foreignKeys": {
960
+ "invoice_history_invoice_id_invoice_id_fk": {
961
+ "name": "invoice_history_invoice_id_invoice_id_fk",
962
+ "tableFrom": "invoice_history",
963
+ "tableTo": "invoice",
964
+ "schemaTo": "invoices",
965
+ "columnsFrom": ["invoice_id"],
966
+ "columnsTo": ["id"],
967
+ "onDelete": "cascade",
968
+ "onUpdate": "no action"
969
+ },
970
+ "invoice_history_actor_user_id_user_id_fk": {
971
+ "name": "invoice_history_actor_user_id_user_id_fk",
972
+ "tableFrom": "invoice_history",
973
+ "tableTo": "user",
974
+ "columnsFrom": ["actor_user_id"],
975
+ "columnsTo": ["id"],
976
+ "onDelete": "restrict",
977
+ "onUpdate": "no action"
978
+ }
979
+ },
980
+ "compositePrimaryKeys": {},
981
+ "uniqueConstraints": {},
982
+ "policies": {},
983
+ "checkConstraints": {},
984
+ "isRLSEnabled": false
985
+ },
986
+ "invoices.invoice_line": {
987
+ "name": "invoice_line",
988
+ "schema": "invoices",
989
+ "columns": {
990
+ "id": {
991
+ "name": "id",
992
+ "type": "text",
993
+ "primaryKey": true,
994
+ "notNull": true
995
+ },
996
+ "invoice_id": {
997
+ "name": "invoice_id",
998
+ "type": "text",
999
+ "primaryKey": false,
1000
+ "notNull": true
1001
+ },
1002
+ "position": {
1003
+ "name": "position",
1004
+ "type": "integer",
1005
+ "primaryKey": false,
1006
+ "notNull": true
1007
+ },
1008
+ "description": {
1009
+ "name": "description",
1010
+ "type": "text",
1011
+ "primaryKey": false,
1012
+ "notNull": true
1013
+ },
1014
+ "quantity_milli": {
1015
+ "name": "quantity_milli",
1016
+ "type": "integer",
1017
+ "primaryKey": false,
1018
+ "notNull": true
1019
+ },
1020
+ "unit": {
1021
+ "name": "unit",
1022
+ "type": "text",
1023
+ "primaryKey": false,
1024
+ "notNull": true,
1025
+ "default": "'item'"
1026
+ },
1027
+ "unit_price_minor": {
1028
+ "name": "unit_price_minor",
1029
+ "type": "integer",
1030
+ "primaryKey": false,
1031
+ "notNull": true
1032
+ },
1033
+ "vat_rate_basis_points": {
1034
+ "name": "vat_rate_basis_points",
1035
+ "type": "integer",
1036
+ "primaryKey": false,
1037
+ "notNull": true,
1038
+ "default": 2100
1039
+ }
1040
+ },
1041
+ "indexes": {
1042
+ "invoice_line_invoice_idx": {
1043
+ "name": "invoice_line_invoice_idx",
1044
+ "columns": [
1045
+ {
1046
+ "expression": "invoice_id",
1047
+ "isExpression": false,
1048
+ "asc": true,
1049
+ "nulls": "last"
1050
+ }
1051
+ ],
1052
+ "isUnique": false,
1053
+ "concurrently": false,
1054
+ "method": "btree",
1055
+ "with": {}
1056
+ }
1057
+ },
1058
+ "foreignKeys": {
1059
+ "invoice_line_invoice_id_invoice_id_fk": {
1060
+ "name": "invoice_line_invoice_id_invoice_id_fk",
1061
+ "tableFrom": "invoice_line",
1062
+ "tableTo": "invoice",
1063
+ "schemaTo": "invoices",
1064
+ "columnsFrom": ["invoice_id"],
1065
+ "columnsTo": ["id"],
1066
+ "onDelete": "cascade",
1067
+ "onUpdate": "no action"
1068
+ }
1069
+ },
1070
+ "compositePrimaryKeys": {},
1071
+ "uniqueConstraints": {},
1072
+ "policies": {},
1073
+ "checkConstraints": {},
1074
+ "isRLSEnabled": false
1075
+ },
1076
+ "invoices.invoice_payment": {
1077
+ "name": "invoice_payment",
1078
+ "schema": "invoices",
1079
+ "columns": {
1080
+ "id": {
1081
+ "name": "id",
1082
+ "type": "text",
1083
+ "primaryKey": true,
1084
+ "notNull": true
1085
+ },
1086
+ "invoice_id": {
1087
+ "name": "invoice_id",
1088
+ "type": "text",
1089
+ "primaryKey": false,
1090
+ "notNull": true
1091
+ },
1092
+ "paid_on": {
1093
+ "name": "paid_on",
1094
+ "type": "date",
1095
+ "primaryKey": false,
1096
+ "notNull": true
1097
+ },
1098
+ "amount_minor": {
1099
+ "name": "amount_minor",
1100
+ "type": "integer",
1101
+ "primaryKey": false,
1102
+ "notNull": true
1103
+ },
1104
+ "reference": {
1105
+ "name": "reference",
1106
+ "type": "text",
1107
+ "primaryKey": false,
1108
+ "notNull": false
1109
+ },
1110
+ "note": {
1111
+ "name": "note",
1112
+ "type": "text",
1113
+ "primaryKey": false,
1114
+ "notNull": false
1115
+ },
1116
+ "created_by_id": {
1117
+ "name": "created_by_id",
1118
+ "type": "text",
1119
+ "primaryKey": false,
1120
+ "notNull": true
1121
+ },
1122
+ "created_at": {
1123
+ "name": "created_at",
1124
+ "type": "timestamp",
1125
+ "primaryKey": false,
1126
+ "notNull": true,
1127
+ "default": "now()"
1128
+ }
1129
+ },
1130
+ "indexes": {
1131
+ "invoice_payment_invoice_idx": {
1132
+ "name": "invoice_payment_invoice_idx",
1133
+ "columns": [
1134
+ {
1135
+ "expression": "invoice_id",
1136
+ "isExpression": false,
1137
+ "asc": true,
1138
+ "nulls": "last"
1139
+ }
1140
+ ],
1141
+ "isUnique": false,
1142
+ "concurrently": false,
1143
+ "method": "btree",
1144
+ "with": {}
1145
+ }
1146
+ },
1147
+ "foreignKeys": {
1148
+ "invoice_payment_invoice_id_invoice_id_fk": {
1149
+ "name": "invoice_payment_invoice_id_invoice_id_fk",
1150
+ "tableFrom": "invoice_payment",
1151
+ "tableTo": "invoice",
1152
+ "schemaTo": "invoices",
1153
+ "columnsFrom": ["invoice_id"],
1154
+ "columnsTo": ["id"],
1155
+ "onDelete": "cascade",
1156
+ "onUpdate": "no action"
1157
+ },
1158
+ "invoice_payment_created_by_id_user_id_fk": {
1159
+ "name": "invoice_payment_created_by_id_user_id_fk",
1160
+ "tableFrom": "invoice_payment",
1161
+ "tableTo": "user",
1162
+ "columnsFrom": ["created_by_id"],
1163
+ "columnsTo": ["id"],
1164
+ "onDelete": "restrict",
1165
+ "onUpdate": "no action"
1166
+ }
1167
+ },
1168
+ "compositePrimaryKeys": {},
1169
+ "uniqueConstraints": {},
1170
+ "policies": {},
1171
+ "checkConstraints": {},
1172
+ "isRLSEnabled": false
1173
+ },
1174
+ "invoices.settings": {
1175
+ "name": "settings",
1176
+ "schema": "invoices",
1177
+ "columns": {
1178
+ "organization_id": {
1179
+ "name": "organization_id",
1180
+ "type": "text",
1181
+ "primaryKey": true,
1182
+ "notNull": true
1183
+ },
1184
+ "enabled": {
1185
+ "name": "enabled",
1186
+ "type": "boolean",
1187
+ "primaryKey": false,
1188
+ "notNull": true,
1189
+ "default": false
1190
+ },
1191
+ "currency": {
1192
+ "name": "currency",
1193
+ "type": "text",
1194
+ "primaryKey": false,
1195
+ "notNull": true,
1196
+ "default": "'EUR'"
1197
+ },
1198
+ "default_vat_rate_basis_points": {
1199
+ "name": "default_vat_rate_basis_points",
1200
+ "type": "integer",
1201
+ "primaryKey": false,
1202
+ "notNull": true,
1203
+ "default": 2100
1204
+ },
1205
+ "address": {
1206
+ "name": "address",
1207
+ "type": "text",
1208
+ "primaryKey": false,
1209
+ "notNull": true,
1210
+ "default": "''"
1211
+ },
1212
+ "registration_number": {
1213
+ "name": "registration_number",
1214
+ "type": "text",
1215
+ "primaryKey": false,
1216
+ "notNull": false
1217
+ },
1218
+ "vat_number": {
1219
+ "name": "vat_number",
1220
+ "type": "text",
1221
+ "primaryKey": false,
1222
+ "notNull": false
1223
+ },
1224
+ "iban": {
1225
+ "name": "iban",
1226
+ "type": "text",
1227
+ "primaryKey": false,
1228
+ "notNull": false
1229
+ },
1230
+ "bic": {
1231
+ "name": "bic",
1232
+ "type": "text",
1233
+ "primaryKey": false,
1234
+ "notNull": false
1235
+ },
1236
+ "invoice_email": {
1237
+ "name": "invoice_email",
1238
+ "type": "text",
1239
+ "primaryKey": false,
1240
+ "notNull": false
1241
+ },
1242
+ "invoice_email_template": {
1243
+ "name": "invoice_email_template",
1244
+ "type": "text",
1245
+ "primaryKey": false,
1246
+ "notNull": false
1247
+ },
1248
+ "preferred_locale": {
1249
+ "name": "preferred_locale",
1250
+ "type": "text",
1251
+ "primaryKey": false,
1252
+ "notNull": true,
1253
+ "default": "'nl'"
1254
+ },
1255
+ "created_at": {
1256
+ "name": "created_at",
1257
+ "type": "timestamp",
1258
+ "primaryKey": false,
1259
+ "notNull": true,
1260
+ "default": "now()"
1261
+ },
1262
+ "updated_at": {
1263
+ "name": "updated_at",
1264
+ "type": "timestamp",
1265
+ "primaryKey": false,
1266
+ "notNull": true,
1267
+ "default": "now()"
1268
+ }
1269
+ },
1270
+ "indexes": {},
1271
+ "foreignKeys": {
1272
+ "settings_organization_id_organization_id_fk": {
1273
+ "name": "settings_organization_id_organization_id_fk",
1274
+ "tableFrom": "settings",
1275
+ "tableTo": "organization",
1276
+ "columnsFrom": ["organization_id"],
1277
+ "columnsTo": ["id"],
1278
+ "onDelete": "cascade",
1279
+ "onUpdate": "no action"
1280
+ }
1281
+ },
1282
+ "compositePrimaryKeys": {},
1283
+ "uniqueConstraints": {},
1284
+ "policies": {},
1285
+ "checkConstraints": {},
1286
+ "isRLSEnabled": false
1287
+ }
1288
+ },
1289
+ "enums": {
1290
+ "invoices.invoice_email_delivery_status": {
1291
+ "name": "invoice_email_delivery_status",
1292
+ "schema": "invoices",
1293
+ "values": ["PENDING", "SENT", "FAILED"]
1294
+ },
1295
+ "invoices.invoice_email_purpose": {
1296
+ "name": "invoice_email_purpose",
1297
+ "schema": "invoices",
1298
+ "values": ["INVOICE", "REMINDER"]
1299
+ },
1300
+ "invoices.invoice_status": {
1301
+ "name": "invoice_status",
1302
+ "schema": "invoices",
1303
+ "values": ["DRAFT", "ISSUED", "PAID", "VOID"]
1304
+ }
1305
+ },
1306
+ "schemas": {
1307
+ "invoices": "invoices"
1308
+ },
1309
+ "sequences": {},
1310
+ "roles": {},
1311
+ "policies": {},
1312
+ "views": {},
1313
+ "_meta": {
1314
+ "columns": {},
1315
+ "schemas": {},
1316
+ "tables": {}
1317
+ }
1318
+ }