fix: error field ambigous
This commit is contained in:
parent
2c790de606
commit
6598cd3bdf
3 changed files with 53 additions and 45 deletions
|
|
@ -31,7 +31,7 @@
|
||||||
"@vitest/ui": "^3.1.4",
|
"@vitest/ui": "^3.1.4",
|
||||||
"nodemon": "^3.1.9",
|
"nodemon": "^3.1.9",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prisma": "^6.16.0",
|
"prisma": "^6.16.2",
|
||||||
"prisma-kysely": "^1.8.0",
|
"prisma-kysely": "^1.8.0",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@elastic/elasticsearch": "^8.17.0",
|
"@elastic/elasticsearch": "^8.17.0",
|
||||||
"@fast-csv/parse": "^5.0.2",
|
"@fast-csv/parse": "^5.0.2",
|
||||||
"@prisma/client": "^6.16.0",
|
"@prisma/client": "^6.16.2",
|
||||||
"@scalar/express-api-reference": "^0.4.182",
|
"@scalar/express-api-reference": "^0.4.182",
|
||||||
"@tsoa/runtime": "^6.6.0",
|
"@tsoa/runtime": "^6.6.0",
|
||||||
"@types/html-to-text": "^9.0.4",
|
"@types/html-to-text": "^9.0.4",
|
||||||
|
|
|
||||||
74
pnpm-lock.yaml
generated
74
pnpm-lock.yaml
generated
|
|
@ -15,8 +15,8 @@ importers:
|
||||||
specifier: ^5.0.2
|
specifier: ^5.0.2
|
||||||
version: 5.0.2
|
version: 5.0.2
|
||||||
'@prisma/client':
|
'@prisma/client':
|
||||||
specifier: ^6.16.0
|
specifier: ^6.16.2
|
||||||
version: 6.16.0(prisma@6.16.0(typescript@5.7.2))(typescript@5.7.2)
|
version: 6.16.2(prisma@6.16.2(typescript@5.7.2))(typescript@5.7.2)
|
||||||
'@scalar/express-api-reference':
|
'@scalar/express-api-reference':
|
||||||
specifier: ^0.4.182
|
specifier: ^0.4.182
|
||||||
version: 0.4.182
|
version: 0.4.182
|
||||||
|
|
@ -82,7 +82,7 @@ importers:
|
||||||
version: 6.10.0
|
version: 6.10.0
|
||||||
prisma-extension-kysely:
|
prisma-extension-kysely:
|
||||||
specifier: ^3.0.0
|
specifier: ^3.0.0
|
||||||
version: 3.0.0(@prisma/client@6.16.0(prisma@6.16.0(typescript@5.7.2))(typescript@5.7.2))
|
version: 3.0.0(@prisma/client@6.16.2(prisma@6.16.2(typescript@5.7.2))(typescript@5.7.2))
|
||||||
promise.any:
|
promise.any:
|
||||||
specifier: ^2.0.6
|
specifier: ^2.0.6
|
||||||
version: 2.0.6
|
version: 2.0.6
|
||||||
|
|
@ -133,8 +133,8 @@ importers:
|
||||||
specifier: ^3.4.2
|
specifier: ^3.4.2
|
||||||
version: 3.4.2
|
version: 3.4.2
|
||||||
prisma:
|
prisma:
|
||||||
specifier: ^6.16.0
|
specifier: ^6.16.2
|
||||||
version: 6.16.0(typescript@5.7.2)
|
version: 6.16.2(typescript@5.7.2)
|
||||||
prisma-kysely:
|
prisma-kysely:
|
||||||
specifier: ^1.8.0
|
specifier: ^1.8.0
|
||||||
version: 1.8.0(encoding@0.1.13)
|
version: 1.8.0(encoding@0.1.13)
|
||||||
|
|
@ -522,8 +522,8 @@ packages:
|
||||||
'@polka/url@1.0.0-next.29':
|
'@polka/url@1.0.0-next.29':
|
||||||
resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==}
|
resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==}
|
||||||
|
|
||||||
'@prisma/client@6.16.0':
|
'@prisma/client@6.16.2':
|
||||||
resolution: {integrity: sha512-FYkFJtgwpwJRMxtmrB26y7gtpR372kyChw6lWng5TMmvn5V+uisy0OyllO5EJD1s8lX78V8X3XjhiXOoMLnu3w==}
|
resolution: {integrity: sha512-E00PxBcalMfYO/TWnXobBVUai6eW/g5OsifWQsQDzJYm7yaY+IRLo7ZLsaefi0QkTpxfuhFcQ/w180i6kX3iJw==}
|
||||||
engines: {node: '>=18.18'}
|
engines: {node: '>=18.18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
prisma: '*'
|
prisma: '*'
|
||||||
|
|
@ -534,14 +534,14 @@ packages:
|
||||||
typescript:
|
typescript:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@prisma/config@6.16.0':
|
'@prisma/config@6.16.2':
|
||||||
resolution: {integrity: sha512-Q9TgfnllVehvQziY9lJwRJLGmziX0OimZUEQ/MhCUBoJMSScj2VivCjw/Of2vlO1FfyaHXxrvjZAr7ASl7DVcw==}
|
resolution: {integrity: sha512-mKXSUrcqXj0LXWPmJsK2s3p9PN+aoAbyMx7m5E1v1FufofR1ZpPoIArjjzOIm+bJRLLvYftoNYLx1tbHgF9/yg==}
|
||||||
|
|
||||||
'@prisma/debug@5.3.1':
|
'@prisma/debug@5.3.1':
|
||||||
resolution: {integrity: sha512-eYrxqslEKf+wpMFIIHgbcNYuZBXUdiJLA85Or3TwOhgPIN1ZoXT9CwJph3ynW8H1Xg0LkdYLwVmuULCwiMoU5A==}
|
resolution: {integrity: sha512-eYrxqslEKf+wpMFIIHgbcNYuZBXUdiJLA85Or3TwOhgPIN1ZoXT9CwJph3ynW8H1Xg0LkdYLwVmuULCwiMoU5A==}
|
||||||
|
|
||||||
'@prisma/debug@6.16.0':
|
'@prisma/debug@6.16.2':
|
||||||
resolution: {integrity: sha512-bxzro5vbVqAPkWyDs2A6GpQtRZunD8tyrLmSAchx9u0b+gWCDY6eV+oh5A0YtYT9245dIxQBswckayHuJG4u3w==}
|
resolution: {integrity: sha512-bo4/gA/HVV6u8YK2uY6glhNsJ7r+k/i5iQ9ny/3q5bt9ijCj7WMPUwfTKPvtEgLP+/r26Z686ly11hhcLiQ8zA==}
|
||||||
|
|
||||||
'@prisma/engines-version@6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43':
|
'@prisma/engines-version@6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43':
|
||||||
resolution: {integrity: sha512-ThvlDaKIVrnrv97ujNFDYiQbeMQpLa0O86HFA2mNoip4mtFqM7U5GSz2ie1i2xByZtvPztJlNRgPsXGeM/kqAA==}
|
resolution: {integrity: sha512-ThvlDaKIVrnrv97ujNFDYiQbeMQpLa0O86HFA2mNoip4mtFqM7U5GSz2ie1i2xByZtvPztJlNRgPsXGeM/kqAA==}
|
||||||
|
|
@ -549,14 +549,14 @@ packages:
|
||||||
'@prisma/engines@5.3.1':
|
'@prisma/engines@5.3.1':
|
||||||
resolution: {integrity: sha512-6QkILNyfeeN67BNEPEtkgh3Xo2tm6D7V+UhrkBbRHqKw9CTaz/vvTP/ROwYSP/3JT2MtIutZm/EnhxUiuOPVDA==}
|
resolution: {integrity: sha512-6QkILNyfeeN67BNEPEtkgh3Xo2tm6D7V+UhrkBbRHqKw9CTaz/vvTP/ROwYSP/3JT2MtIutZm/EnhxUiuOPVDA==}
|
||||||
|
|
||||||
'@prisma/engines@6.16.0':
|
'@prisma/engines@6.16.2':
|
||||||
resolution: {integrity: sha512-RHJGCH/zi017W4CWYWqg0Sv1pquGGFVo8T3auJ9sodDNaiRzbeNldydjaQzszVS8nscdtcvLuJzy7e65C3puqQ==}
|
resolution: {integrity: sha512-7yf3AjfPUgsg/l7JSu1iEhsmZZ/YE00yURPjTikqm2z4btM0bCl2coFtTGfeSOWbQMmq45Jab+53yGUIAT1sjA==}
|
||||||
|
|
||||||
'@prisma/fetch-engine@5.3.1':
|
'@prisma/fetch-engine@5.3.1':
|
||||||
resolution: {integrity: sha512-w1yk1YiK8N82Pobdq58b85l6e8akyrkxuzwV9DoiUTRf3gpsuhJJesHc4Yi0WzUC9/3znizl1UfCsI6dhkj3Vw==}
|
resolution: {integrity: sha512-w1yk1YiK8N82Pobdq58b85l6e8akyrkxuzwV9DoiUTRf3gpsuhJJesHc4Yi0WzUC9/3znizl1UfCsI6dhkj3Vw==}
|
||||||
|
|
||||||
'@prisma/fetch-engine@6.16.0':
|
'@prisma/fetch-engine@6.16.2':
|
||||||
resolution: {integrity: sha512-Mx5rml0XRIDizhB9eZxSP8c0nMoXYVITTiJJwxlWn9rNCel8mG8NAqIw+vJlN3gPR+kt3IBkP1SQVsplPPpYrA==}
|
resolution: {integrity: sha512-wPnZ8DMRqpgzye758ZvfAMiNJRuYpz+rhgEBZi60ZqDIgOU2694oJxiuu3GKFeYeR/hXxso4/2oBC243t/whxQ==}
|
||||||
|
|
||||||
'@prisma/generator-helper@5.3.1':
|
'@prisma/generator-helper@5.3.1':
|
||||||
resolution: {integrity: sha512-zrYS0iHLgPlOJjYnd5KvVMMvSS+ktOL39EwooS5EnyvfzwfzxlKCeOUgxTfiKYs0WUWqzEvyNAYtramYgSknsQ==}
|
resolution: {integrity: sha512-zrYS0iHLgPlOJjYnd5KvVMMvSS+ktOL39EwooS5EnyvfzwfzxlKCeOUgxTfiKYs0WUWqzEvyNAYtramYgSknsQ==}
|
||||||
|
|
@ -564,8 +564,8 @@ packages:
|
||||||
'@prisma/get-platform@5.3.1':
|
'@prisma/get-platform@5.3.1':
|
||||||
resolution: {integrity: sha512-3IiZY2BUjKnAuZ0569zppZE6/rZbVAM09//c2nvPbbkGG9MqrirA8fbhhF7tfVmhyVfdmVCHnf/ujWPHJ8B46Q==}
|
resolution: {integrity: sha512-3IiZY2BUjKnAuZ0569zppZE6/rZbVAM09//c2nvPbbkGG9MqrirA8fbhhF7tfVmhyVfdmVCHnf/ujWPHJ8B46Q==}
|
||||||
|
|
||||||
'@prisma/get-platform@6.16.0':
|
'@prisma/get-platform@6.16.2':
|
||||||
resolution: {integrity: sha512-eaJOOvAoGslSUTjiQrtE9E0hoBdfL43j8SymOGD6LbdrKRNtIoiy6qiBaEr2fNYD+R/Qns7QOwPhl7SVHJayKA==}
|
resolution: {integrity: sha512-U/P36Uke5wS7r1+omtAgJpEB94tlT4SdlgaeTc6HVTTT93pXj7zZ+B/cZnmnvjcNPfWddgoDx8RLjmQwqGDYyA==}
|
||||||
|
|
||||||
'@prisma/internals@5.3.1':
|
'@prisma/internals@5.3.1':
|
||||||
resolution: {integrity: sha512-zkW73hPHHNrMD21PeYgCTBfMu71vzJf+WtfydtJbS0JVJKyLfOel0iWSQg7wjNeQfccKp+NdHJ/5rTJ4NEUzgA==}
|
resolution: {integrity: sha512-zkW73hPHHNrMD21PeYgCTBfMu71vzJf+WtfydtJbS0JVJKyLfOel0iWSQg7wjNeQfccKp+NdHJ/5rTJ4NEUzgA==}
|
||||||
|
|
@ -2683,8 +2683,8 @@ packages:
|
||||||
resolution: {integrity: sha512-VpNpolZ8RXRgfU+j4R+fPZmX8EE95w3vJ2tt7+FwuiQc0leNTfLK5QLf3KbbPDes2rfjh3g20AjDxefQIo5GIA==}
|
resolution: {integrity: sha512-VpNpolZ8RXRgfU+j4R+fPZmX8EE95w3vJ2tt7+FwuiQc0leNTfLK5QLf3KbbPDes2rfjh3g20AjDxefQIo5GIA==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
prisma@6.16.0:
|
prisma@6.16.2:
|
||||||
resolution: {integrity: sha512-TTh+H1Kw8N68KN9cDzdAyMroqMOvdCO/Z+kS2wKEVYR1nuR21qH5Q/Db/bZHsAgw7l/TPHtM/veG5VABcdwPDw==}
|
resolution: {integrity: sha512-aRvldGE5UUJTtVmFiH3WfNFNiqFlAtePUxcI0UEGlnXCX7DqhiMT5TRYwncHFeA/Reca5W6ToXXyCMTeFPdSXA==}
|
||||||
engines: {node: '>=18.18'}
|
engines: {node: '>=18.18'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
|
@ -3979,12 +3979,12 @@ snapshots:
|
||||||
|
|
||||||
'@polka/url@1.0.0-next.29': {}
|
'@polka/url@1.0.0-next.29': {}
|
||||||
|
|
||||||
'@prisma/client@6.16.0(prisma@6.16.0(typescript@5.7.2))(typescript@5.7.2)':
|
'@prisma/client@6.16.2(prisma@6.16.2(typescript@5.7.2))(typescript@5.7.2)':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
prisma: 6.16.0(typescript@5.7.2)
|
prisma: 6.16.2(typescript@5.7.2)
|
||||||
typescript: 5.7.2
|
typescript: 5.7.2
|
||||||
|
|
||||||
'@prisma/config@6.16.0':
|
'@prisma/config@6.16.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
c12: 3.1.0
|
c12: 3.1.0
|
||||||
deepmerge-ts: 7.1.5
|
deepmerge-ts: 7.1.5
|
||||||
|
|
@ -4001,18 +4001,18 @@ snapshots:
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@prisma/debug@6.16.0': {}
|
'@prisma/debug@6.16.2': {}
|
||||||
|
|
||||||
'@prisma/engines-version@6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43': {}
|
'@prisma/engines-version@6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43': {}
|
||||||
|
|
||||||
'@prisma/engines@5.3.1': {}
|
'@prisma/engines@5.3.1': {}
|
||||||
|
|
||||||
'@prisma/engines@6.16.0':
|
'@prisma/engines@6.16.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@prisma/debug': 6.16.0
|
'@prisma/debug': 6.16.2
|
||||||
'@prisma/engines-version': 6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43
|
'@prisma/engines-version': 6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43
|
||||||
'@prisma/fetch-engine': 6.16.0
|
'@prisma/fetch-engine': 6.16.2
|
||||||
'@prisma/get-platform': 6.16.0
|
'@prisma/get-platform': 6.16.2
|
||||||
|
|
||||||
'@prisma/fetch-engine@5.3.1(encoding@0.1.13)':
|
'@prisma/fetch-engine@5.3.1(encoding@0.1.13)':
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
@ -4037,11 +4037,11 @@ snapshots:
|
||||||
- encoding
|
- encoding
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@prisma/fetch-engine@6.16.0':
|
'@prisma/fetch-engine@6.16.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@prisma/debug': 6.16.0
|
'@prisma/debug': 6.16.2
|
||||||
'@prisma/engines-version': 6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43
|
'@prisma/engines-version': 6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43
|
||||||
'@prisma/get-platform': 6.16.0
|
'@prisma/get-platform': 6.16.2
|
||||||
|
|
||||||
'@prisma/generator-helper@5.3.1':
|
'@prisma/generator-helper@5.3.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
@ -4067,9 +4067,9 @@ snapshots:
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@prisma/get-platform@6.16.0':
|
'@prisma/get-platform@6.16.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@prisma/debug': 6.16.0
|
'@prisma/debug': 6.16.2
|
||||||
|
|
||||||
'@prisma/internals@5.3.1(encoding@0.1.13)':
|
'@prisma/internals@5.3.1(encoding@0.1.13)':
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
@ -6457,9 +6457,9 @@ snapshots:
|
||||||
|
|
||||||
prettier@3.4.2: {}
|
prettier@3.4.2: {}
|
||||||
|
|
||||||
prisma-extension-kysely@3.0.0(@prisma/client@6.16.0(prisma@6.16.0(typescript@5.7.2))(typescript@5.7.2)):
|
prisma-extension-kysely@3.0.0(@prisma/client@6.16.2(prisma@6.16.2(typescript@5.7.2))(typescript@5.7.2)):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@prisma/client': 6.16.0(prisma@6.16.0(typescript@5.7.2))(typescript@5.7.2)
|
'@prisma/client': 6.16.2(prisma@6.16.2(typescript@5.7.2))(typescript@5.7.2)
|
||||||
|
|
||||||
prisma-kysely@1.8.0(encoding@0.1.13):
|
prisma-kysely@1.8.0(encoding@0.1.13):
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
@ -6472,10 +6472,10 @@ snapshots:
|
||||||
- encoding
|
- encoding
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
prisma@6.16.0(typescript@5.7.2):
|
prisma@6.16.2(typescript@5.7.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@prisma/config': 6.16.0
|
'@prisma/config': 6.16.2
|
||||||
'@prisma/engines': 6.16.0
|
'@prisma/engines': 6.16.2
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
typescript: 5.7.2
|
typescript: 5.7.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
|
|
||||||
|
|
@ -618,9 +618,22 @@ export class StatsController extends Controller {
|
||||||
startDate = dayjs(startDate).startOf("month").add(1, "month").toDate();
|
startDate = dayjs(startDate).startOf("month").add(1, "month").toDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const invoices = await tx.invoice.findMany({
|
||||||
|
select: { id: true },
|
||||||
|
where: {
|
||||||
|
quotation: {
|
||||||
|
quotationStatus: { notIn: [QuotationStatus.Canceled] },
|
||||||
|
registeredBranch: { OR: permissionCondCompany(req.user) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (invoices.length === 0) return [];
|
||||||
|
|
||||||
return await Promise.all(
|
return await Promise.all(
|
||||||
months.map(async (v) => {
|
months.map(async (v) => {
|
||||||
const date = dayjs(v);
|
const date = dayjs(v);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
month: date.format("MM"),
|
month: date.format("MM"),
|
||||||
year: date.format("YYYY"),
|
year: date.format("YYYY"),
|
||||||
|
|
@ -629,12 +642,7 @@ export class StatsController extends Controller {
|
||||||
_sum: { amount: true },
|
_sum: { amount: true },
|
||||||
where: {
|
where: {
|
||||||
createdAt: { gte: v, lte: date.endOf("month").toDate() },
|
createdAt: { gte: v, lte: date.endOf("month").toDate() },
|
||||||
invoice: {
|
invoiceId: { in: invoices.map((v) => v.id) },
|
||||||
quotation: {
|
|
||||||
quotationStatus: { notIn: [QuotationStatus.Canceled] },
|
|
||||||
registeredBranch: { OR: permissionCondCompany(req.user) },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
by: "paymentStatus",
|
by: "paymentStatus",
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue