storemw-core-api 1.0.42 → 1.0.44
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.
- package/dist/lib/query_builder/queryDocument.js +1 -1
- package/dist/lib/query_builder/queryDocument.js.map +1 -1
- package/dist/models/branch/UserBranchModel.d.ts +68 -68
- package/dist/models/business/BusinessModel.d.ts +46 -46
- package/dist/models/document/DocumentDocumentModel.d.ts +13 -13
- package/dist/models/document/DocumentItemModel.d.ts +23 -23
- package/dist/models/document/DocumentProfileModel.d.ts +89 -89
- package/dist/models/file/FileModel.d.ts +79 -79
- package/dist/models/index.d.ts +0 -2
- package/dist/models/index.js +2 -4
- package/dist/models/index.js.map +1 -1
- package/dist/models/injection_field/DocumentInjectionFieldModel.d.ts +871 -475
- package/dist/models/injection_field/InjectionFieldModel.d.ts +13 -13
- package/dist/models/injection_field/ItemInjectionFieldModel.d.ts +1124 -376
- package/dist/models/injection_field/LogisticInjectionFieldModel.d.ts +244 -24
- package/dist/models/injection_field/RepositoryInjectionFieldModel.d.ts +167 -68
- package/dist/models/injection_field/UserInjectionFieldModel.d.ts +761 -200
- package/dist/models/item/ItemModel.d.ts +13 -13
- package/dist/models/location/LocationModel.d.ts +77 -77
- package/dist/models/location/LocationRackModel.d.ts +20 -20
- package/dist/models/location/LocationSlotModel.d.ts +20 -20
- package/dist/models/others/NumberDateSequenceModel.d.ts +13 -13
- package/dist/models/region/AreaModel.d.ts +23 -23
- package/dist/models/region/StateModel.d.ts +10 -10
- package/dist/models/user/CustomerModel.d.ts +13 -13
- package/dist/schema/payload/document/schemaDocument.d.ts +2 -2
- package/dist/schema/payload/document/schemaDocumentDeliveryOrder.d.ts +32 -32
- package/dist/schema/payload/document/schemaDocumentProformaSales.d.ts +32 -32
- package/dist/schema/payload/document/schemaDocumentReplacementDeliveryOrder.d.ts +32 -32
- package/dist/schema/payload/document/schemaDocumentSalesOrder.d.ts +32 -32
- package/dist/schema/payload/document/schemaDocumentTripOrder.d.ts +12 -12
- package/dist/schema/payload/file/schemaFile.d.ts +4 -4
- package/dist/schema/payload/injection_field/schemaInjectionField.d.ts +128 -128
- package/dist/services/document/DeliveryOrderService.js.map +1 -1
- package/dist/services/document/DocumentDocumentService.d.ts +1 -1
- package/dist/services/document/DocumentItemService.d.ts +2 -2
- package/dist/services/document/DocumentProfileService.d.ts +8 -8
- package/dist/services/document/ProformaSalesService.js.map +1 -1
- package/dist/services/document/ReplacementDeliveryService.js.map +1 -1
- package/dist/services/document/SalesOrderService.js.map +1 -1
- package/dist/services/document/TripOrderService.js.map +1 -1
- package/dist/services/file/FileGoogleCloudStorageProvider.d.ts +13 -1
- package/dist/services/file/FileGoogleCloudStorageProvider.js +32 -10
- package/dist/services/file/FileGoogleCloudStorageProvider.js.map +1 -1
- package/dist/services/file/FileLocalStorageProvider.js +24 -8
- package/dist/services/file/FileLocalStorageProvider.js.map +1 -1
- package/dist/services/file/FileService.d.ts +3299 -33
- package/dist/services/file/FileService.js +9 -5
- package/dist/services/file/FileService.js.map +1 -1
- package/dist/services/file/FileStorageProviderRegistry.d.ts +26 -2
- package/dist/services/injection_field/InjectionFieldService.d.ts +2 -2
- package/dist/services/item/ItemItemService.d.ts +3 -3
- package/dist/services/location/LocationLocationService.d.ts +21 -21
- package/dist/services/location/LocationRackService.d.ts +6 -6
- package/dist/services/location/LocationSlotService.d.ts +6 -6
- package/dist/services/others/NumberDateSequenceService.d.ts +2 -2
- package/dist/services/region/AreaService.d.ts +6 -6
- package/dist/services/region/StateService.d.ts +3 -3
- package/dist/services/user/CustomerService.d.ts +3 -3
- package/package.json +1 -1
- package/prisma/schema.prisma +2789 -2288
|
@@ -46,7 +46,7 @@ const getDocumentSqlRelationMaps = (documentTypeKey) => {
|
|
|
46
46
|
updater: (0, queryBuilder_1.buildSqlRelation)("left", "maindoc", "users", "updater", ["maindoc.updateuserid = updater.user_id", "updater.isdelete = false", "updater.istrash = false"]),
|
|
47
47
|
dif: (0, queryBuilder_1.buildSqlRelation)("left", "maindoc", "document_injection_fields", "dif", ["maindoc.document_id = dif.document_id", "dif.field_ref = 'document'", `dif.field_module = '${documentTypeKey.toLowerCase()}'`, "dif.isdelete = false", "dif.istrash = false"]),
|
|
48
48
|
difi: (0, queryBuilder_1.buildSqlRelation)("left", "docitm", "document_injection_fields", "difi", ["docitm.document_item_id = difi.document_item_id", "difi.field_ref = 'document_item'", `difi.field_module = '${documentTypeKey.toLowerCase()}'`, "difi.isdelete = false", "difi.istrash = false"]),
|
|
49
|
-
difdoc: (0, queryBuilder_1.buildSqlRelation)("left", "docdoc", "document_injection_fields", "difdoc", ["docdoc.
|
|
49
|
+
difdoc: (0, queryBuilder_1.buildSqlRelation)("left", "docdoc", "document_injection_fields", "difdoc", ["docdoc.document_id = difdoc.document_doc_id", "difdoc.field_ref = 'document_item'", `difdoc.field_module = '${documentTypeKey.toLowerCase()}'`, "difdoc.isdelete = false", "difdoc.istrash = false"]),
|
|
50
50
|
docitm: (0, queryBuilder_1.buildSqlRelation)("left", "maindoc", "document_items", "docitm", ["maindoc.document_id = docitm.document_id", "docitm.isdelete = false", "docitm.istrash = false"]),
|
|
51
51
|
docdoc: (0, queryBuilder_1.buildSqlRelation)("left", "maindoc", "document_documents", "docdoc", ["maindoc.document_id = docdoc.main_document_id", `LOWER(docdoc.main_document_type) = LOWER('${documentTypeKey}')`, "docdoc.isdelete = false", "docdoc.istrash = false"]),
|
|
52
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryDocument.js","sourceRoot":"","sources":["../../../src/lib/query_builder/queryDocument.ts"],"names":[],"mappings":";;;AAAA,qCAaiB;AAEjB,iDAAkD;AAE3C,MAAM,0BAA0B,GAAG,CAAC,eAAuB,EAAE,EAAE;IAElE,IAAI,YAAY,GAAG;QACf,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,YAAY;QACxB,SAAS,EAAE,WAAW;QACtB,cAAc,EAAE,gBAAgB;QAChC,cAAc,EAAE,gBAAg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,IAAI,oCAA2B,CAAC,gBAAgB,4BAA4B;QAC5E,IAAI,oCAA2B,CAAC,aAAa,yBAAyB;QACtE,IAAI,oCAA2B,CAAC,gBAAgB,4BAA4B;QAC5E,IAAI,oCAA2B,CAAC,eAAe,2BAA2B;QAC1E,IAAI,oCAA2B,CAAC,aAAa,yBAAyB;KACzE,CAAA;AACL,CAAC,CAAA;AAhBY,QAAA,iCAAiC,qCAgB7C;AAEM,MAAM,8BAA8B,GAAG,CAAC,oBAA8B,EAAE,EAAE;IAC7E,OAAO;QACH,CAAC;;;0BAGiB,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;;;UAG/C,CAAC,EAAE,WAAW;KACnB,CAAA;AACL,CAAC,CAAA;AAVY,QAAA,8BAA8B,kCAU1C","sourcesContent":["import {\n ModelDocumentFields,\n ModelDocumentProfileFields,\n ModelDocumentAmountFields,\n ModelDocumentLocationFields,\n ModelDocumentTotalFields,\n ModelDocumentItemFields,\n ModelLocationFields,\n ModelAreaFields,\n ModelStateFields,\n ModelCountryFields,\n ModelUserFields,\n ModelDocumentDocumentFields\n} from \"@/models\"\n\nimport { buildSqlRelation } from \"./queryBuilder\";\n\nexport const getDocumentSqlRelationMaps = (documentTypeKey: string) => {\n\n let relationKeys = {\n docpromain: \"docpromain\",\n docproship: \"docproship\",\n docprobil: \"docprobil\",\n docproareamain: \"docproareamain\",\n docproareaship: \"docproareaship\",\n docproareabil: \"docproareabil\",\n docprostatemain: \"docprostatemain\",\n docprostateship: \"docprostateship\",\n docprostatebil: \"docprostatebil\",\n docprocoumain: \"docprocoumain\",\n docprocouship: \"docprocouship\",\n docprocoubil: \"docprocoubil\",\n docttl: \"docttl\",\n maindocloc: \"maindocloc\",\n creator: \"creator\",\n updater: \"updater\",\n docitm: \"docitm\",\n dif: \"dif\",\n difi: \"difi\",\n difdoc: \"difdoc\",\n docdoc: \"docdoc\",\n };\n\n let sqlRelationMaps: Record<keyof typeof relationKeys, ReturnType<typeof buildSqlRelation>> = {\n docpromain: buildSqlRelation(\"left\", \"maindoc\", \"document_profiles\", \"docpromain\", [\"maindoc.document_id = docpromain.document_id\", \"docpromain.isdelete = false\", `LOWER(docpromain.type) = LOWER('PROFILE')`, \"docpromain.istrash = false\"]),\n docproship: buildSqlRelation(\"left\", \"maindoc\", \"document_profiles\", \"docproship\", [\"maindoc.document_id = docproship.document_id\", \"docproship.isdelete = false\", `LOWER(docproship.type) = LOWER('SHIPPING')`, \"docproship.istrash = false\"]),\n docprobil: buildSqlRelation(\"left\", \"maindoc\", \"document_profiles\", \"docprobil\", [\"maindoc.document_id = docprobil.document_id\", \"docprobil.isdelete = false\", `LOWER(docprobil.type) = LOWER('BILLING')`, \"docprobil.istrash = false\"]),\n docproareamain: buildSqlRelation(\"left\", \"maindoc\", \"areas\", \"docproareamain\", [\"docpromain.area_id = docproareamain.area_id\", \"docproareamain.isdelete = false\", \"docproareamain.istrash = false\"]),\n docproareaship: buildSqlRelation(\"left\", \"maindoc\", \"areas\", \"docproareaship\", [\"docproship.area_id = docproareaship.area_id\", \"docproareaship.isdelete = false\", \"docproareaship.istrash = false\"]),\n docproareabil: buildSqlRelation(\"left\", \"maindoc\", \"areas\", \"docproareabil\", [\"docprobil.area_id = docproareabil.area_id\", \"docproareabil.isdelete = false\", \"docproareabil.istrash = false\"]),\n docprostatemain: buildSqlRelation(\"left\", \"maindoc\", \"states\", \"docprostatemain\", [\"docpromain.state_id = docprostatemain.state_id\", \"docprostatemain.isdelete = false\", \"docprostatemain.istrash = false\"]),\n docprostateship: buildSqlRelation(\"left\", \"maindoc\", \"states\", \"docprostateship\", [\"docproship.state_id = docprostateship.state_id\", \"docprostateship.isdelete = false\", \"docprostateship.istrash = false\"]),\n docprostatebil: buildSqlRelation(\"left\", \"maindoc\", \"states\", \"docprostatebil\", [\"docprobil.state_id = docprostatebil.state_id\", \"docprostatebil.isdelete = false\", \"docprostatebil.istrash = false\"]),\n docprocoumain: buildSqlRelation(\"left\", \"maindoc\", \"countries\", \"docprocoumain\", [\"docpromain.country_id = docprocoumain.country_id\", \"docprocoumain.isdelete = false\", \"docprocoumain.istrash = false\"]),\n docprocouship: buildSqlRelation(\"left\", \"maindoc\", \"countries\", \"docprocouship\", [\"docproship.country_id = docprocouship.country_id\", \"docprocouship.isdelete = false\", \"docprocouship.istrash = false\"]),\n docprocoubil: buildSqlRelation(\"left\", \"maindoc\", \"countries\", \"docprocoubil\", [\"docprobil.country_id = docprocoubil.country_id\", \"docprocoubil.isdelete = false\", \"docprocoubil.istrash = false\"]),\n docttl: buildSqlRelation(\"left\", \"maindoc\", \"document_totals\", \"docttl\", [\"maindoc.document_id = docttl.document_id\", `LOWER(docttl.type) = LOWER('${documentTypeKey}')`, \"docttl.isdelete = false\", \"docttl.istrash = false\"]),\n maindocloc: buildSqlRelation(\"left\", \"maindoc\", \"locations\", \"maindocloc\", [\"maindoc.location_id = maindocloc.location_id\", \"maindocloc.isdelete = false\", \"maindocloc.istrash = false\"]),\n creator: buildSqlRelation(\"left\", \"maindoc\", \"users\", \"creator\", [\"maindoc.createuserid = creator.user_id\", \"creator.isdelete = false\", \"creator.istrash = false\"]),\n updater: buildSqlRelation(\"left\", \"maindoc\", \"users\", \"updater\", [\"maindoc.updateuserid = updater.user_id\", \"updater.isdelete = false\", \"updater.istrash = false\"]),\n dif: buildSqlRelation(\"left\", \"maindoc\", \"document_injection_fields\", \"dif\", [\"maindoc.document_id = dif.document_id\", \"dif.field_ref = 'document'\", `dif.field_module = '${documentTypeKey.toLowerCase()}'`, \"dif.isdelete = false\", \"dif.istrash = false\"]),\n difi: buildSqlRelation(\"left\", \"docitm\", \"document_injection_fields\", \"difi\", [\"docitm.document_item_id = difi.document_item_id\", \"difi.field_ref = 'document_item'\", `difi.field_module = '${documentTypeKey.toLowerCase()}'`, \"difi.isdelete = false\", \"difi.istrash = false\"]),\n difdoc: buildSqlRelation(\"left\", \"docdoc\", \"document_injection_fields\", \"difdoc\", [\"docdoc.doc_id = difdoc.document_doc_id\", \"difdoc.field_ref = 'document_item'\", `difdoc.field_module = '${documentTypeKey.toLowerCase()}'`, \"difdoc.isdelete = false\", \"difdoc.istrash = false\"]),\n docitm: buildSqlRelation(\"left\", \"maindoc\", \"document_items\", \"docitm\", [\"maindoc.document_id = docitm.document_id\", \"docitm.isdelete = false\", \"docitm.istrash = false\"]),\n docdoc: buildSqlRelation(\"left\", \"maindoc\", \"document_documents\", \"docdoc\", [\"maindoc.document_id = docdoc.main_document_id\", `LOWER(docdoc.main_document_type) = LOWER('${documentTypeKey}')`, \"docdoc.isdelete = false\", \"docdoc.istrash = false\"]),\n };\n\n return {\n sqlRelationMaps,\n relationKeys\n }\n\n}\n\nexport const buildDocumentMainSqlSelect = (skipAmount: boolean = false) => {\n\n let main = {\n [`maindoc.${ModelDocumentFields.document_id}`]: \"document_id\",\n [`LOWER(maindoc.${ModelDocumentFields.doc_type})`]: \"doc_type\",\n [`maindoc.${ModelDocumentFields.doc_number}`]: \"doc_number\",\n [`TO_CHAR(maindoc.${ModelDocumentFields.doc_date}, 'YYYY-MM-DD')`]: \"doc_date\",\n [`maindoc.${ModelDocumentFields.doc_reference1_id}`]: \"doc_reference1_id\",\n [`maindoc.${ModelDocumentFields.doc_reference1_label}`]: \"doc_reference1_label\",\n [`maindoc.${ModelDocumentFields.doc_reference2_id}`]: \"doc_reference2_id\",\n [`maindoc.${ModelDocumentFields.doc_reference2_label}`]: \"doc_reference2_label\",\n [`maindoc.${ModelDocumentFields.doc_remark}`]: \"doc_remark\",\n [`maindocloc.${ModelLocationFields.location_id}`]: \"location_id\",\n [`maindocloc.${ModelLocationFields.location_name}`]: \"location_name\",\n [`maindocloc.${ModelLocationFields.location_code}`]: \"location_code\",\n [`maindocloc.${ModelLocationFields.location_type}`]: \"location_type\",\n }\n\n if (skipAmount === false) {\n main = {\n ...main,\n ...{\n [`maindoc.${ModelDocumentFields.subtotal_amount}::float`]: \"subtotal_amount\",\n [`maindoc.${ModelDocumentFields.discount_amount}::float`]: \"discount_amount\",\n [`maindoc.${ModelDocumentFields.tax_amount}::float`]: \"tax_amount\",\n [`maindoc.${ModelDocumentFields.rounding_amount}::float`]: \"rounding_amount\",\n [`maindoc.${ModelDocumentFields.service_charge_amount}::float`]: \"service_charge_amount\",\n [`maindoc.${ModelDocumentFields.delivery_charge_amount}::float`]: \"delivery_charge_amount\",\n [`maindoc.${ModelDocumentFields.total_amount}::float`]: \"total_amount\",\n [`maindoc.${ModelDocumentFields.grand_total_amount}::float`]: \"grand_total_amount\",\n [`maindoc.${ModelDocumentFields.paid_amount}::float`]: \"paid_amount\",\n [`maindoc.${ModelDocumentFields.balance_amount}::float`]: \"balance_amount\",\n }\n }\n }\n\n return main\n\n}\n\nexport const buildDocumentDefaultSqlSelect = () => {\n return {\n [`maindoc.${ModelDocumentFields.createdatetime}`]: \"createdatetime\",\n [`creator.${ModelUserFields.login_username}`]: \"createusername\",\n [`maindoc.${ModelDocumentFields.updatedatetime}`]: \"updatedatetime\",\n [`updater.${ModelUserFields.login_username}`]: \"updateusername\",\n [`maindoc.${ModelDocumentFields.isdelete}`]: \"isdelete\",\n [`maindoc.${ModelDocumentFields.istrash}`]: \"istrash\",\n [`maindoc.${ModelDocumentFields.accountid}`]: \"accountid\",\n }\n}\n\n// export const buildDocumentAmountSqlSelect = () => {\n// return {\n// [`CAST(docamt.${ModelDocumentAmountFields.total_amount} as float8)`]: \"total_amount\",\n// [`CAST(docamt.${ModelDocumentAmountFields.sub_amount} as float8)`]: \"sub_amount\"\n// }\n// }\n\nexport const buildDocumentLocationSqlSelect = () => {\n return {\n [`docloc.${ModelDocumentLocationFields.location_id}`]: \"location_id\",\n [`loc.${ModelLocationFields.location_code}`]: \"location_code\",\n [`loc.${ModelLocationFields.location_name}`]: \"location_name\",\n }\n}\n\nexport const buildDocumentTotalSqlSelect = () => {\n return {\n [`COALESCE(\n jsonb_agg(\n DISTINCT jsonb_build_object(\n '${ModelDocumentTotalFields.document_total_id}', docttl.document_total_id,\n '${ModelDocumentTotalFields.refer_id}', docttl.refer_id,\n /* '${ModelDocumentTotalFields.document_id}', docttl.document_id, */\n '${ModelDocumentTotalFields.total_type}', docttl.total_type,\n '${ModelDocumentTotalFields.operation}', docttl.operation,\n '${ModelDocumentTotalFields.total_amount}', docttl.total_amount,\n '${ModelDocumentTotalFields.description}', docttl.description,\n '${ModelDocumentTotalFields.total_percentage}', docttl.total_percentage\n )\n ) FILTER (WHERE docttl.document_total_id IS NOT NULL), '[]'::jsonb\n )`]: \"totals\"\n }\n}\n\nexport const buildDocumentProfileSqlSelect = (aliasProfile: string, aliasState: string, aliasCountry: string, aliasArea: string, prefix: string) => {\n return {\n [`${aliasProfile}.${ModelDocumentProfileFields.document_profile_id}`]: `${prefix}document_profile_id`,\n [`${aliasProfile}.${ModelDocumentProfileFields.code}`]: `${prefix}code`,\n [`${aliasProfile}.${ModelDocumentProfileFields.name}`]: `${prefix}name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.profile_name}`]: `${prefix}profile_name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.address_1}`]: `${prefix}address_1`,\n [`${aliasProfile}.${ModelDocumentProfileFields.address_2}`]: `${prefix}address_2`,\n [`${aliasProfile}.${ModelDocumentProfileFields.contact}`]: `${prefix}contact`,\n [`${aliasProfile}.${ModelDocumentProfileFields.email}`]: `${prefix}email`,\n [`${aliasProfile}.${ModelDocumentProfileFields.postcode}`]: `${prefix}postcode`,\n // [`${aliasProfile}.${ModelDocumentProfileFields.area}`]: `${prefix}area`,\n [`${aliasProfile}.${ModelDocumentProfileFields.area_id}`]: `${prefix}area_id`,\n [`${aliasArea}.${ModelAreaFields.area_name}`]: `${prefix}area_name`,\n [`${aliasCountry}.${ModelCountryFields.country_name}`]: `${prefix}country_name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.country_id}`]: `${prefix}country_id`,\n [`${aliasState}.${ModelStateFields.state_name}`]: `${prefix}state_name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.state_id}`]: `${prefix}state_id`,\n [`${aliasProfile}.${ModelDocumentProfileFields.user_id}`]: `${prefix}user_id`,\n [`${aliasProfile}.${ModelDocumentProfileFields.user_branch_id}`]: `${prefix}user_branch_id`\n }\n}\n\nexport const buildDocumentItemSqlSelectAgg = () => {\n return [\n `'${ModelDocumentItemFields.document_item_id}', docitm.document_item_id`,\n `'${ModelDocumentItemFields.document_item_id}', docitm.document_item_id`,\n `'${ModelDocumentItemFields.document_doc_id}', docitm.document_doc_id`,\n `'${ModelDocumentItemFields.item_id}', docitm.item_id`,\n `'${ModelDocumentItemFields.uom_id}', docitm.uom_id`,\n `'${ModelDocumentItemFields.code}', docitm.code`,\n `'${ModelDocumentItemFields.description}', docitm.description`,\n `'${ModelDocumentItemFields.item_name}', docitm.item_name`,\n `'${ModelDocumentItemFields.quantity}', docitm.quantity`,\n `'${ModelDocumentItemFields.total_amount}', docitm.total_amount`,\n `'${ModelDocumentItemFields.unit_amount}', docitm.unit_amount`,\n `'${ModelDocumentItemFields.uom}', docitm.uom`,\n ]\n}\n\nexport const buildDocumentItemSqlSelect = (itemSqlSelectAgg: string[]) => {\n return {\n [`COALESCE(\n jsonb_agg(\n DISTINCT jsonb_build_object(\n ${itemSqlSelectAgg.join(\", \")}\n )\n ) FILTER (WHERE docitm.document_item_id IS NOT NULL), '[]'::jsonb\n )`]: \"items\"\n }\n}\n\nexport const buildDocumentDocumentSqlSelectAgg = () => {\n return [\n `'${ModelDocumentDocumentFields.document_document_id}', docdoc.document_document_id`,\n `'${ModelDocumentDocumentFields.main_document_id}', docdoc.main_document_id`,\n `'${ModelDocumentDocumentFields.main_document_type}', docdoc.main_document_type`,\n `'${ModelDocumentDocumentFields.location_id}', docdoc.location_id`,\n `'${ModelDocumentDocumentFields.document_id}', docdoc.document_id`,\n `'${ModelDocumentDocumentFields.document_date}', docdoc.document_date`,\n `'${ModelDocumentDocumentFields.document_number}', docdoc.document_number`,\n `'${ModelDocumentDocumentFields.reference1_id}', docdoc.reference1_id`,\n `'${ModelDocumentDocumentFields.reference1_label}', docdoc.reference1_label`,\n `'${ModelDocumentDocumentFields.reference2_id}', docdoc.reference2_id`,\n `'${ModelDocumentDocumentFields.reference2_label}', docdoc.reference2_label`,\n `'${ModelDocumentDocumentFields.document_remark}', docdoc.document_remark`,\n `'${ModelDocumentDocumentFields.document_type}', docdoc.document_type`,\n ]\n}\n\nexport const buildDocumentDocumentSqlSelect = (documentSqlSelectAgg: string[]) => {\n return {\n [`COALESCE(\n jsonb_agg(\n DISTINCT jsonb_build_object(\n ${documentSqlSelectAgg.join(\", \")}\n )\n ) FILTER (WHERE docdoc.document_document_id IS NOT NULL), '[]'::jsonb\n )`]: \"documents\"\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"queryDocument.js","sourceRoot":"","sources":["../../../src/lib/query_builder/queryDocument.ts"],"names":[],"mappings":";;;AAAA,qCAaiB;AAEjB,iDAAkD;AAE3C,MAAM,0BAA0B,GAAG,CAAC,eAAuB,EAAE,EAAE;IAElE,IAAI,YAAY,GAAG;QACf,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,YAAY;QACxB,SAAS,EAAE,WAAW;QACtB,cAAc,EAAE,gBAAgB;QAChC,cAAc,EAAE,gBAAgB;QAChC,aAAa,EAAE,eAAe;QAC9B,eAAe,EAAE,iBAAiB;QAClC,eAAe,EAAE,iBAAiB;QAClC,cAAc,EAAE,gBAAgB;QAChC,aAAa,EAAE,eAAe;QAC9B,aAAa,EAAE,eAAe;QAC9B,YAAY,EAAE,cAAc;QAC5B,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,YAAY;QACxB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACnB,CAAC;IAEF,IAAI,eAAe,GAA2E;QAC1F,UAAU,EAAE,IAAA,+BAAgB,EAAC,MAAM,EAAE,SAA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ModelDocumentFields,\n ModelDocumentProfileFields,\n ModelDocumentAmountFields,\n ModelDocumentLocationFields,\n ModelDocumentTotalFields,\n ModelDocumentItemFields,\n ModelLocationFields,\n ModelAreaFields,\n ModelStateFields,\n ModelCountryFields,\n ModelUserFields,\n ModelDocumentDocumentFields\n} from \"@/models\"\n\nimport { buildSqlRelation } from \"./queryBuilder\";\n\nexport const getDocumentSqlRelationMaps = (documentTypeKey: string) => {\n\n let relationKeys = {\n docpromain: \"docpromain\",\n docproship: \"docproship\",\n docprobil: \"docprobil\",\n docproareamain: \"docproareamain\",\n docproareaship: \"docproareaship\",\n docproareabil: \"docproareabil\",\n docprostatemain: \"docprostatemain\",\n docprostateship: \"docprostateship\",\n docprostatebil: \"docprostatebil\",\n docprocoumain: \"docprocoumain\",\n docprocouship: \"docprocouship\",\n docprocoubil: \"docprocoubil\",\n docttl: \"docttl\",\n maindocloc: \"maindocloc\",\n creator: \"creator\",\n updater: \"updater\",\n docitm: \"docitm\",\n dif: \"dif\",\n difi: \"difi\",\n difdoc: \"difdoc\",\n docdoc: \"docdoc\",\n };\n\n let sqlRelationMaps: Record<keyof typeof relationKeys, ReturnType<typeof buildSqlRelation>> = {\n docpromain: buildSqlRelation(\"left\", \"maindoc\", \"document_profiles\", \"docpromain\", [\"maindoc.document_id = docpromain.document_id\", \"docpromain.isdelete = false\", `LOWER(docpromain.type) = LOWER('PROFILE')`, \"docpromain.istrash = false\"]),\n docproship: buildSqlRelation(\"left\", \"maindoc\", \"document_profiles\", \"docproship\", [\"maindoc.document_id = docproship.document_id\", \"docproship.isdelete = false\", `LOWER(docproship.type) = LOWER('SHIPPING')`, \"docproship.istrash = false\"]),\n docprobil: buildSqlRelation(\"left\", \"maindoc\", \"document_profiles\", \"docprobil\", [\"maindoc.document_id = docprobil.document_id\", \"docprobil.isdelete = false\", `LOWER(docprobil.type) = LOWER('BILLING')`, \"docprobil.istrash = false\"]),\n docproareamain: buildSqlRelation(\"left\", \"maindoc\", \"areas\", \"docproareamain\", [\"docpromain.area_id = docproareamain.area_id\", \"docproareamain.isdelete = false\", \"docproareamain.istrash = false\"]),\n docproareaship: buildSqlRelation(\"left\", \"maindoc\", \"areas\", \"docproareaship\", [\"docproship.area_id = docproareaship.area_id\", \"docproareaship.isdelete = false\", \"docproareaship.istrash = false\"]),\n docproareabil: buildSqlRelation(\"left\", \"maindoc\", \"areas\", \"docproareabil\", [\"docprobil.area_id = docproareabil.area_id\", \"docproareabil.isdelete = false\", \"docproareabil.istrash = false\"]),\n docprostatemain: buildSqlRelation(\"left\", \"maindoc\", \"states\", \"docprostatemain\", [\"docpromain.state_id = docprostatemain.state_id\", \"docprostatemain.isdelete = false\", \"docprostatemain.istrash = false\"]),\n docprostateship: buildSqlRelation(\"left\", \"maindoc\", \"states\", \"docprostateship\", [\"docproship.state_id = docprostateship.state_id\", \"docprostateship.isdelete = false\", \"docprostateship.istrash = false\"]),\n docprostatebil: buildSqlRelation(\"left\", \"maindoc\", \"states\", \"docprostatebil\", [\"docprobil.state_id = docprostatebil.state_id\", \"docprostatebil.isdelete = false\", \"docprostatebil.istrash = false\"]),\n docprocoumain: buildSqlRelation(\"left\", \"maindoc\", \"countries\", \"docprocoumain\", [\"docpromain.country_id = docprocoumain.country_id\", \"docprocoumain.isdelete = false\", \"docprocoumain.istrash = false\"]),\n docprocouship: buildSqlRelation(\"left\", \"maindoc\", \"countries\", \"docprocouship\", [\"docproship.country_id = docprocouship.country_id\", \"docprocouship.isdelete = false\", \"docprocouship.istrash = false\"]),\n docprocoubil: buildSqlRelation(\"left\", \"maindoc\", \"countries\", \"docprocoubil\", [\"docprobil.country_id = docprocoubil.country_id\", \"docprocoubil.isdelete = false\", \"docprocoubil.istrash = false\"]),\n docttl: buildSqlRelation(\"left\", \"maindoc\", \"document_totals\", \"docttl\", [\"maindoc.document_id = docttl.document_id\", `LOWER(docttl.type) = LOWER('${documentTypeKey}')`, \"docttl.isdelete = false\", \"docttl.istrash = false\"]),\n maindocloc: buildSqlRelation(\"left\", \"maindoc\", \"locations\", \"maindocloc\", [\"maindoc.location_id = maindocloc.location_id\", \"maindocloc.isdelete = false\", \"maindocloc.istrash = false\"]),\n creator: buildSqlRelation(\"left\", \"maindoc\", \"users\", \"creator\", [\"maindoc.createuserid = creator.user_id\", \"creator.isdelete = false\", \"creator.istrash = false\"]),\n updater: buildSqlRelation(\"left\", \"maindoc\", \"users\", \"updater\", [\"maindoc.updateuserid = updater.user_id\", \"updater.isdelete = false\", \"updater.istrash = false\"]),\n dif: buildSqlRelation(\"left\", \"maindoc\", \"document_injection_fields\", \"dif\", [\"maindoc.document_id = dif.document_id\", \"dif.field_ref = 'document'\", `dif.field_module = '${documentTypeKey.toLowerCase()}'`, \"dif.isdelete = false\", \"dif.istrash = false\"]),\n difi: buildSqlRelation(\"left\", \"docitm\", \"document_injection_fields\", \"difi\", [\"docitm.document_item_id = difi.document_item_id\", \"difi.field_ref = 'document_item'\", `difi.field_module = '${documentTypeKey.toLowerCase()}'`, \"difi.isdelete = false\", \"difi.istrash = false\"]),\n difdoc: buildSqlRelation(\"left\", \"docdoc\", \"document_injection_fields\", \"difdoc\", [\"docdoc.document_id = difdoc.document_doc_id\", \"difdoc.field_ref = 'document_item'\", `difdoc.field_module = '${documentTypeKey.toLowerCase()}'`, \"difdoc.isdelete = false\", \"difdoc.istrash = false\"]),\n docitm: buildSqlRelation(\"left\", \"maindoc\", \"document_items\", \"docitm\", [\"maindoc.document_id = docitm.document_id\", \"docitm.isdelete = false\", \"docitm.istrash = false\"]),\n docdoc: buildSqlRelation(\"left\", \"maindoc\", \"document_documents\", \"docdoc\", [\"maindoc.document_id = docdoc.main_document_id\", `LOWER(docdoc.main_document_type) = LOWER('${documentTypeKey}')`, \"docdoc.isdelete = false\", \"docdoc.istrash = false\"]),\n };\n\n return {\n sqlRelationMaps,\n relationKeys\n }\n\n}\n\nexport const buildDocumentMainSqlSelect = (skipAmount: boolean = false) => {\n\n let main = {\n [`maindoc.${ModelDocumentFields.document_id}`]: \"document_id\",\n [`LOWER(maindoc.${ModelDocumentFields.doc_type})`]: \"doc_type\",\n [`maindoc.${ModelDocumentFields.doc_number}`]: \"doc_number\",\n [`TO_CHAR(maindoc.${ModelDocumentFields.doc_date}, 'YYYY-MM-DD')`]: \"doc_date\",\n [`maindoc.${ModelDocumentFields.doc_reference1_id}`]: \"doc_reference1_id\",\n [`maindoc.${ModelDocumentFields.doc_reference1_label}`]: \"doc_reference1_label\",\n [`maindoc.${ModelDocumentFields.doc_reference2_id}`]: \"doc_reference2_id\",\n [`maindoc.${ModelDocumentFields.doc_reference2_label}`]: \"doc_reference2_label\",\n [`maindoc.${ModelDocumentFields.doc_remark}`]: \"doc_remark\",\n [`maindocloc.${ModelLocationFields.location_id}`]: \"location_id\",\n [`maindocloc.${ModelLocationFields.location_name}`]: \"location_name\",\n [`maindocloc.${ModelLocationFields.location_code}`]: \"location_code\",\n [`maindocloc.${ModelLocationFields.location_type}`]: \"location_type\",\n }\n\n if (skipAmount === false) {\n main = {\n ...main,\n ...{\n [`maindoc.${ModelDocumentFields.subtotal_amount}::float`]: \"subtotal_amount\",\n [`maindoc.${ModelDocumentFields.discount_amount}::float`]: \"discount_amount\",\n [`maindoc.${ModelDocumentFields.tax_amount}::float`]: \"tax_amount\",\n [`maindoc.${ModelDocumentFields.rounding_amount}::float`]: \"rounding_amount\",\n [`maindoc.${ModelDocumentFields.service_charge_amount}::float`]: \"service_charge_amount\",\n [`maindoc.${ModelDocumentFields.delivery_charge_amount}::float`]: \"delivery_charge_amount\",\n [`maindoc.${ModelDocumentFields.total_amount}::float`]: \"total_amount\",\n [`maindoc.${ModelDocumentFields.grand_total_amount}::float`]: \"grand_total_amount\",\n [`maindoc.${ModelDocumentFields.paid_amount}::float`]: \"paid_amount\",\n [`maindoc.${ModelDocumentFields.balance_amount}::float`]: \"balance_amount\",\n }\n }\n }\n\n return main\n\n}\n\nexport const buildDocumentDefaultSqlSelect = () => {\n return {\n [`maindoc.${ModelDocumentFields.createdatetime}`]: \"createdatetime\",\n [`creator.${ModelUserFields.login_username}`]: \"createusername\",\n [`maindoc.${ModelDocumentFields.updatedatetime}`]: \"updatedatetime\",\n [`updater.${ModelUserFields.login_username}`]: \"updateusername\",\n [`maindoc.${ModelDocumentFields.isdelete}`]: \"isdelete\",\n [`maindoc.${ModelDocumentFields.istrash}`]: \"istrash\",\n [`maindoc.${ModelDocumentFields.accountid}`]: \"accountid\",\n }\n}\n\n// export const buildDocumentAmountSqlSelect = () => {\n// return {\n// [`CAST(docamt.${ModelDocumentAmountFields.total_amount} as float8)`]: \"total_amount\",\n// [`CAST(docamt.${ModelDocumentAmountFields.sub_amount} as float8)`]: \"sub_amount\"\n// }\n// }\n\nexport const buildDocumentLocationSqlSelect = () => {\n return {\n [`docloc.${ModelDocumentLocationFields.location_id}`]: \"location_id\",\n [`loc.${ModelLocationFields.location_code}`]: \"location_code\",\n [`loc.${ModelLocationFields.location_name}`]: \"location_name\",\n }\n}\n\nexport const buildDocumentTotalSqlSelect = () => {\n return {\n [`COALESCE(\n jsonb_agg(\n DISTINCT jsonb_build_object(\n '${ModelDocumentTotalFields.document_total_id}', docttl.document_total_id,\n '${ModelDocumentTotalFields.refer_id}', docttl.refer_id,\n /* '${ModelDocumentTotalFields.document_id}', docttl.document_id, */\n '${ModelDocumentTotalFields.total_type}', docttl.total_type,\n '${ModelDocumentTotalFields.operation}', docttl.operation,\n '${ModelDocumentTotalFields.total_amount}', docttl.total_amount,\n '${ModelDocumentTotalFields.description}', docttl.description,\n '${ModelDocumentTotalFields.total_percentage}', docttl.total_percentage\n )\n ) FILTER (WHERE docttl.document_total_id IS NOT NULL), '[]'::jsonb\n )`]: \"totals\"\n }\n}\n\nexport const buildDocumentProfileSqlSelect = (aliasProfile: string, aliasState: string, aliasCountry: string, aliasArea: string, prefix: string) => {\n return {\n [`${aliasProfile}.${ModelDocumentProfileFields.document_profile_id}`]: `${prefix}document_profile_id`,\n [`${aliasProfile}.${ModelDocumentProfileFields.code}`]: `${prefix}code`,\n [`${aliasProfile}.${ModelDocumentProfileFields.name}`]: `${prefix}name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.profile_name}`]: `${prefix}profile_name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.address_1}`]: `${prefix}address_1`,\n [`${aliasProfile}.${ModelDocumentProfileFields.address_2}`]: `${prefix}address_2`,\n [`${aliasProfile}.${ModelDocumentProfileFields.contact}`]: `${prefix}contact`,\n [`${aliasProfile}.${ModelDocumentProfileFields.email}`]: `${prefix}email`,\n [`${aliasProfile}.${ModelDocumentProfileFields.postcode}`]: `${prefix}postcode`,\n // [`${aliasProfile}.${ModelDocumentProfileFields.area}`]: `${prefix}area`,\n [`${aliasProfile}.${ModelDocumentProfileFields.area_id}`]: `${prefix}area_id`,\n [`${aliasArea}.${ModelAreaFields.area_name}`]: `${prefix}area_name`,\n [`${aliasCountry}.${ModelCountryFields.country_name}`]: `${prefix}country_name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.country_id}`]: `${prefix}country_id`,\n [`${aliasState}.${ModelStateFields.state_name}`]: `${prefix}state_name`,\n [`${aliasProfile}.${ModelDocumentProfileFields.state_id}`]: `${prefix}state_id`,\n [`${aliasProfile}.${ModelDocumentProfileFields.user_id}`]: `${prefix}user_id`,\n [`${aliasProfile}.${ModelDocumentProfileFields.user_branch_id}`]: `${prefix}user_branch_id`\n }\n}\n\nexport const buildDocumentItemSqlSelectAgg = () => {\n return [\n `'${ModelDocumentItemFields.document_item_id}', docitm.document_item_id`,\n `'${ModelDocumentItemFields.document_item_id}', docitm.document_item_id`,\n `'${ModelDocumentItemFields.document_doc_id}', docitm.document_doc_id`,\n `'${ModelDocumentItemFields.item_id}', docitm.item_id`,\n `'${ModelDocumentItemFields.uom_id}', docitm.uom_id`,\n `'${ModelDocumentItemFields.code}', docitm.code`,\n `'${ModelDocumentItemFields.description}', docitm.description`,\n `'${ModelDocumentItemFields.item_name}', docitm.item_name`,\n `'${ModelDocumentItemFields.quantity}', docitm.quantity`,\n `'${ModelDocumentItemFields.total_amount}', docitm.total_amount`,\n `'${ModelDocumentItemFields.unit_amount}', docitm.unit_amount`,\n `'${ModelDocumentItemFields.uom}', docitm.uom`,\n ]\n}\n\nexport const buildDocumentItemSqlSelect = (itemSqlSelectAgg: string[]) => {\n return {\n [`COALESCE(\n jsonb_agg(\n DISTINCT jsonb_build_object(\n ${itemSqlSelectAgg.join(\", \")}\n )\n ) FILTER (WHERE docitm.document_item_id IS NOT NULL), '[]'::jsonb\n )`]: \"items\"\n }\n}\n\nexport const buildDocumentDocumentSqlSelectAgg = () => {\n return [\n `'${ModelDocumentDocumentFields.document_document_id}', docdoc.document_document_id`,\n `'${ModelDocumentDocumentFields.main_document_id}', docdoc.main_document_id`,\n `'${ModelDocumentDocumentFields.main_document_type}', docdoc.main_document_type`,\n `'${ModelDocumentDocumentFields.location_id}', docdoc.location_id`,\n `'${ModelDocumentDocumentFields.document_id}', docdoc.document_id`,\n `'${ModelDocumentDocumentFields.document_date}', docdoc.document_date`,\n `'${ModelDocumentDocumentFields.document_number}', docdoc.document_number`,\n `'${ModelDocumentDocumentFields.reference1_id}', docdoc.reference1_id`,\n `'${ModelDocumentDocumentFields.reference1_label}', docdoc.reference1_label`,\n `'${ModelDocumentDocumentFields.reference2_id}', docdoc.reference2_id`,\n `'${ModelDocumentDocumentFields.reference2_label}', docdoc.reference2_label`,\n `'${ModelDocumentDocumentFields.document_remark}', docdoc.document_remark`,\n `'${ModelDocumentDocumentFields.document_type}', docdoc.document_type`,\n ]\n}\n\nexport const buildDocumentDocumentSqlSelect = (documentSqlSelectAgg: string[]) => {\n return {\n [`COALESCE(\n jsonb_agg(\n DISTINCT jsonb_build_object(\n ${documentSqlSelectAgg.join(\", \")}\n )\n ) FILTER (WHERE docdoc.document_document_id IS NOT NULL), '[]'::jsonb\n )`]: \"documents\"\n }\n}"]}
|
|
@@ -13,19 +13,19 @@ export declare const ModelUserBranchFields: {
|
|
|
13
13
|
isdelete: "isdelete";
|
|
14
14
|
istrash: "istrash";
|
|
15
15
|
accountid: "accountid";
|
|
16
|
-
|
|
16
|
+
address_1: "address_1";
|
|
17
|
+
address_2: "address_2";
|
|
18
|
+
postcode: "postcode";
|
|
17
19
|
state_id: "state_id";
|
|
20
|
+
country_id: "country_id";
|
|
21
|
+
area_id: "area_id";
|
|
22
|
+
remark: "remark";
|
|
18
23
|
branch_id: "branch_id";
|
|
19
24
|
branch_name: "branch_name";
|
|
20
25
|
branch_code: "branch_code";
|
|
21
|
-
address_1: "address_1";
|
|
22
|
-
address_2: "address_2";
|
|
23
|
-
country_id: "country_id";
|
|
24
|
-
postcode: "postcode";
|
|
25
26
|
pic_name: "pic_name";
|
|
26
27
|
pic_contact: "pic_contact";
|
|
27
28
|
pic_email: "pic_email";
|
|
28
|
-
remark: "remark";
|
|
29
29
|
is_hq: "is_hq";
|
|
30
30
|
branch_contact: "branch_contact";
|
|
31
31
|
branch_email: "branch_email";
|
|
@@ -59,7 +59,7 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
59
59
|
accountId: number;
|
|
60
60
|
actionUserId: number;
|
|
61
61
|
}) => {
|
|
62
|
-
primaryKey: "type" | "status" | "area" | "user_id" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "
|
|
62
|
+
primaryKey: "type" | "status" | "area" | "user_id" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "address_1" | "address_2" | "postcode" | "state_id" | "country_id" | "area_id" | "remark" | "branch_id" | "branch_name" | "branch_code" | "pic_name" | "pic_contact" | "pic_email" | "is_hq" | "branch_contact" | "branch_email";
|
|
63
63
|
getFields: (prefix?: string, excludeKeywords?: string[]) => Promise<{
|
|
64
64
|
name: string;
|
|
65
65
|
type: string;
|
|
@@ -78,19 +78,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
78
78
|
isdelete: boolean | null;
|
|
79
79
|
istrash: boolean | null;
|
|
80
80
|
accountid: bigint;
|
|
81
|
-
|
|
81
|
+
address_1: string | null;
|
|
82
|
+
address_2: string | null;
|
|
83
|
+
postcode: string | null;
|
|
82
84
|
state_id: bigint | null;
|
|
85
|
+
country_id: bigint | null;
|
|
86
|
+
area_id: bigint | null;
|
|
87
|
+
remark: string | null;
|
|
83
88
|
branch_id: bigint;
|
|
84
89
|
branch_name: string | null;
|
|
85
90
|
branch_code: string | null;
|
|
86
|
-
address_1: string | null;
|
|
87
|
-
address_2: string | null;
|
|
88
|
-
country_id: bigint | null;
|
|
89
|
-
postcode: string | null;
|
|
90
91
|
pic_name: string | null;
|
|
91
92
|
pic_contact: string | null;
|
|
92
93
|
pic_email: string | null;
|
|
93
|
-
remark: string | null;
|
|
94
94
|
is_hq: number;
|
|
95
95
|
branch_contact: string | null;
|
|
96
96
|
branch_email: string | null;
|
|
@@ -110,19 +110,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
110
110
|
isdelete: boolean | null;
|
|
111
111
|
istrash: boolean | null;
|
|
112
112
|
accountid: bigint;
|
|
113
|
-
|
|
113
|
+
address_1: string | null;
|
|
114
|
+
address_2: string | null;
|
|
115
|
+
postcode: string | null;
|
|
114
116
|
state_id: bigint | null;
|
|
117
|
+
country_id: bigint | null;
|
|
118
|
+
area_id: bigint | null;
|
|
119
|
+
remark: string | null;
|
|
115
120
|
branch_id: bigint;
|
|
116
121
|
branch_name: string | null;
|
|
117
122
|
branch_code: string | null;
|
|
118
|
-
address_1: string | null;
|
|
119
|
-
address_2: string | null;
|
|
120
|
-
country_id: bigint | null;
|
|
121
|
-
postcode: string | null;
|
|
122
123
|
pic_name: string | null;
|
|
123
124
|
pic_contact: string | null;
|
|
124
125
|
pic_email: string | null;
|
|
125
|
-
remark: string | null;
|
|
126
126
|
is_hq: number;
|
|
127
127
|
branch_contact: string | null;
|
|
128
128
|
branch_email: string | null;
|
|
@@ -143,19 +143,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
143
143
|
isdelete: boolean | null;
|
|
144
144
|
istrash: boolean | null;
|
|
145
145
|
accountid: bigint;
|
|
146
|
-
|
|
146
|
+
address_1: string | null;
|
|
147
|
+
address_2: string | null;
|
|
148
|
+
postcode: string | null;
|
|
147
149
|
state_id: bigint | null;
|
|
150
|
+
country_id: bigint | null;
|
|
151
|
+
area_id: bigint | null;
|
|
152
|
+
remark: string | null;
|
|
148
153
|
branch_id: bigint;
|
|
149
154
|
branch_name: string | null;
|
|
150
155
|
branch_code: string | null;
|
|
151
|
-
address_1: string | null;
|
|
152
|
-
address_2: string | null;
|
|
153
|
-
country_id: bigint | null;
|
|
154
|
-
postcode: string | null;
|
|
155
156
|
pic_name: string | null;
|
|
156
157
|
pic_contact: string | null;
|
|
157
158
|
pic_email: string | null;
|
|
158
|
-
remark: string | null;
|
|
159
159
|
is_hq: number;
|
|
160
160
|
branch_contact: string | null;
|
|
161
161
|
branch_email: string | null;
|
|
@@ -172,19 +172,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
172
172
|
isdelete: boolean | null;
|
|
173
173
|
istrash: boolean | null;
|
|
174
174
|
accountid: bigint;
|
|
175
|
-
|
|
175
|
+
address_1: string | null;
|
|
176
|
+
address_2: string | null;
|
|
177
|
+
postcode: string | null;
|
|
176
178
|
state_id: bigint | null;
|
|
179
|
+
country_id: bigint | null;
|
|
180
|
+
area_id: bigint | null;
|
|
181
|
+
remark: string | null;
|
|
177
182
|
branch_id: bigint;
|
|
178
183
|
branch_name: string | null;
|
|
179
184
|
branch_code: string | null;
|
|
180
|
-
address_1: string | null;
|
|
181
|
-
address_2: string | null;
|
|
182
|
-
country_id: bigint | null;
|
|
183
|
-
postcode: string | null;
|
|
184
185
|
pic_name: string | null;
|
|
185
186
|
pic_contact: string | null;
|
|
186
187
|
pic_email: string | null;
|
|
187
|
-
remark: string | null;
|
|
188
188
|
is_hq: number;
|
|
189
189
|
branch_contact: string | null;
|
|
190
190
|
branch_email: string | null;
|
|
@@ -193,7 +193,7 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
193
193
|
where?: Record<string, any>;
|
|
194
194
|
}) => Promise<number>;
|
|
195
195
|
aggregate: ({ field, operation, where, }: {
|
|
196
|
-
field: "type" | "status" | "area" | "user_id" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "
|
|
196
|
+
field: "type" | "status" | "area" | "user_id" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "address_1" | "address_2" | "postcode" | "state_id" | "country_id" | "area_id" | "remark" | "branch_id" | "branch_name" | "branch_code" | "pic_name" | "pic_contact" | "pic_email" | "is_hq" | "branch_contact" | "branch_email";
|
|
197
197
|
operation?: "sum" | "avg" | "min" | "max" | "count";
|
|
198
198
|
where?: Record<string, any>;
|
|
199
199
|
}) => Promise<number>;
|
|
@@ -212,19 +212,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
212
212
|
isdelete: boolean | null;
|
|
213
213
|
istrash: boolean | null;
|
|
214
214
|
accountid: bigint;
|
|
215
|
-
|
|
215
|
+
address_1: string | null;
|
|
216
|
+
address_2: string | null;
|
|
217
|
+
postcode: string | null;
|
|
216
218
|
state_id: bigint | null;
|
|
219
|
+
country_id: bigint | null;
|
|
220
|
+
area_id: bigint | null;
|
|
221
|
+
remark: string | null;
|
|
217
222
|
branch_id: bigint;
|
|
218
223
|
branch_name: string | null;
|
|
219
224
|
branch_code: string | null;
|
|
220
|
-
address_1: string | null;
|
|
221
|
-
address_2: string | null;
|
|
222
|
-
country_id: bigint | null;
|
|
223
|
-
postcode: string | null;
|
|
224
225
|
pic_name: string | null;
|
|
225
226
|
pic_contact: string | null;
|
|
226
227
|
pic_email: string | null;
|
|
227
|
-
remark: string | null;
|
|
228
228
|
is_hq: number;
|
|
229
229
|
branch_contact: string | null;
|
|
230
230
|
branch_email: string | null;
|
|
@@ -242,19 +242,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
242
242
|
isdelete: boolean | null;
|
|
243
243
|
istrash: boolean | null;
|
|
244
244
|
accountid: bigint;
|
|
245
|
-
|
|
245
|
+
address_1: string | null;
|
|
246
|
+
address_2: string | null;
|
|
247
|
+
postcode: string | null;
|
|
246
248
|
state_id: bigint | null;
|
|
249
|
+
country_id: bigint | null;
|
|
250
|
+
area_id: bigint | null;
|
|
251
|
+
remark: string | null;
|
|
247
252
|
branch_id: bigint;
|
|
248
253
|
branch_name: string | null;
|
|
249
254
|
branch_code: string | null;
|
|
250
|
-
address_1: string | null;
|
|
251
|
-
address_2: string | null;
|
|
252
|
-
country_id: bigint | null;
|
|
253
|
-
postcode: string | null;
|
|
254
255
|
pic_name: string | null;
|
|
255
256
|
pic_contact: string | null;
|
|
256
257
|
pic_email: string | null;
|
|
257
|
-
remark: string | null;
|
|
258
258
|
is_hq: number;
|
|
259
259
|
branch_contact: string | null;
|
|
260
260
|
branch_email: string | null;
|
|
@@ -274,19 +274,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
274
274
|
isdelete: boolean | null;
|
|
275
275
|
istrash: boolean | null;
|
|
276
276
|
accountid: bigint;
|
|
277
|
-
|
|
277
|
+
address_1: string | null;
|
|
278
|
+
address_2: string | null;
|
|
279
|
+
postcode: string | null;
|
|
278
280
|
state_id: bigint | null;
|
|
281
|
+
country_id: bigint | null;
|
|
282
|
+
area_id: bigint | null;
|
|
283
|
+
remark: string | null;
|
|
279
284
|
branch_id: bigint;
|
|
280
285
|
branch_name: string | null;
|
|
281
286
|
branch_code: string | null;
|
|
282
|
-
address_1: string | null;
|
|
283
|
-
address_2: string | null;
|
|
284
|
-
country_id: bigint | null;
|
|
285
|
-
postcode: string | null;
|
|
286
287
|
pic_name: string | null;
|
|
287
288
|
pic_contact: string | null;
|
|
288
289
|
pic_email: string | null;
|
|
289
|
-
remark: string | null;
|
|
290
290
|
is_hq: number;
|
|
291
291
|
branch_contact: string | null;
|
|
292
292
|
branch_email: string | null;
|
|
@@ -305,19 +305,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
305
305
|
isdelete: boolean | null;
|
|
306
306
|
istrash: boolean | null;
|
|
307
307
|
accountid: bigint;
|
|
308
|
-
|
|
308
|
+
address_1: string | null;
|
|
309
|
+
address_2: string | null;
|
|
310
|
+
postcode: string | null;
|
|
309
311
|
state_id: bigint | null;
|
|
312
|
+
country_id: bigint | null;
|
|
313
|
+
area_id: bigint | null;
|
|
314
|
+
remark: string | null;
|
|
310
315
|
branch_id: bigint;
|
|
311
316
|
branch_name: string | null;
|
|
312
317
|
branch_code: string | null;
|
|
313
|
-
address_1: string | null;
|
|
314
|
-
address_2: string | null;
|
|
315
|
-
country_id: bigint | null;
|
|
316
|
-
postcode: string | null;
|
|
317
318
|
pic_name: string | null;
|
|
318
319
|
pic_contact: string | null;
|
|
319
320
|
pic_email: string | null;
|
|
320
|
-
remark: string | null;
|
|
321
321
|
is_hq: number;
|
|
322
322
|
branch_contact: string | null;
|
|
323
323
|
branch_email: string | null;
|
|
@@ -336,19 +336,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
336
336
|
isdelete: boolean | null;
|
|
337
337
|
istrash: boolean | null;
|
|
338
338
|
accountid: bigint;
|
|
339
|
-
|
|
339
|
+
address_1: string | null;
|
|
340
|
+
address_2: string | null;
|
|
341
|
+
postcode: string | null;
|
|
340
342
|
state_id: bigint | null;
|
|
343
|
+
country_id: bigint | null;
|
|
344
|
+
area_id: bigint | null;
|
|
345
|
+
remark: string | null;
|
|
341
346
|
branch_id: bigint;
|
|
342
347
|
branch_name: string | null;
|
|
343
348
|
branch_code: string | null;
|
|
344
|
-
address_1: string | null;
|
|
345
|
-
address_2: string | null;
|
|
346
|
-
country_id: bigint | null;
|
|
347
|
-
postcode: string | null;
|
|
348
349
|
pic_name: string | null;
|
|
349
350
|
pic_contact: string | null;
|
|
350
351
|
pic_email: string | null;
|
|
351
|
-
remark: string | null;
|
|
352
352
|
is_hq: number;
|
|
353
353
|
branch_contact: string | null;
|
|
354
354
|
branch_email: string | null;
|
|
@@ -368,19 +368,19 @@ export declare const UserBranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
368
368
|
isdelete: boolean | null;
|
|
369
369
|
istrash: boolean | null;
|
|
370
370
|
accountid: bigint;
|
|
371
|
-
|
|
371
|
+
address_1: string | null;
|
|
372
|
+
address_2: string | null;
|
|
373
|
+
postcode: string | null;
|
|
372
374
|
state_id: bigint | null;
|
|
375
|
+
country_id: bigint | null;
|
|
376
|
+
area_id: bigint | null;
|
|
377
|
+
remark: string | null;
|
|
373
378
|
branch_id: bigint;
|
|
374
379
|
branch_name: string | null;
|
|
375
380
|
branch_code: string | null;
|
|
376
|
-
address_1: string | null;
|
|
377
|
-
address_2: string | null;
|
|
378
|
-
country_id: bigint | null;
|
|
379
|
-
postcode: string | null;
|
|
380
381
|
pic_name: string | null;
|
|
381
382
|
pic_contact: string | null;
|
|
382
383
|
pic_email: string | null;
|
|
383
|
-
remark: string | null;
|
|
384
384
|
is_hq: number;
|
|
385
385
|
branch_contact: string | null;
|
|
386
386
|
branch_email: string | null;
|
|
@@ -11,13 +11,13 @@ export declare const ModelBusinessFields: {
|
|
|
11
11
|
istrash: "istrash";
|
|
12
12
|
accountid: "accountid";
|
|
13
13
|
business_id: "business_id";
|
|
14
|
-
email: "email";
|
|
15
|
-
area_id: "area_id";
|
|
16
|
-
state_id: "state_id";
|
|
17
14
|
address_1: "address_1";
|
|
18
15
|
address_2: "address_2";
|
|
19
|
-
country_id: "country_id";
|
|
20
16
|
postcode: "postcode";
|
|
17
|
+
state_id: "state_id";
|
|
18
|
+
country_id: "country_id";
|
|
19
|
+
area_id: "area_id";
|
|
20
|
+
email: "email";
|
|
21
21
|
company_name: "company_name";
|
|
22
22
|
id_number: "id_number";
|
|
23
23
|
website: "website";
|
|
@@ -56,7 +56,7 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
56
56
|
accountId: number;
|
|
57
57
|
actionUserId: number;
|
|
58
58
|
}) => {
|
|
59
|
-
primaryKey: "status" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "business_id" | "
|
|
59
|
+
primaryKey: "status" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "business_id" | "address_1" | "address_2" | "postcode" | "state_id" | "country_id" | "area_id" | "email" | "company_name" | "id_number" | "website" | "company_contact";
|
|
60
60
|
getFields: (prefix?: string, excludeKeywords?: string[]) => Promise<{
|
|
61
61
|
name: string;
|
|
62
62
|
type: string;
|
|
@@ -73,13 +73,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
73
73
|
istrash: boolean | null;
|
|
74
74
|
accountid: bigint;
|
|
75
75
|
business_id: bigint;
|
|
76
|
-
email: string | null;
|
|
77
|
-
area_id: bigint | null;
|
|
78
|
-
state_id: bigint | null;
|
|
79
76
|
address_1: string | null;
|
|
80
77
|
address_2: string | null;
|
|
81
|
-
country_id: bigint | null;
|
|
82
78
|
postcode: string | null;
|
|
79
|
+
state_id: bigint | null;
|
|
80
|
+
country_id: bigint | null;
|
|
81
|
+
area_id: bigint | null;
|
|
82
|
+
email: string | null;
|
|
83
83
|
company_name: string | null;
|
|
84
84
|
id_number: string | null;
|
|
85
85
|
website: string | null;
|
|
@@ -98,13 +98,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
98
98
|
istrash: boolean | null;
|
|
99
99
|
accountid: bigint;
|
|
100
100
|
business_id: bigint;
|
|
101
|
-
email: string | null;
|
|
102
|
-
area_id: bigint | null;
|
|
103
|
-
state_id: bigint | null;
|
|
104
101
|
address_1: string | null;
|
|
105
102
|
address_2: string | null;
|
|
106
|
-
country_id: bigint | null;
|
|
107
103
|
postcode: string | null;
|
|
104
|
+
state_id: bigint | null;
|
|
105
|
+
country_id: bigint | null;
|
|
106
|
+
area_id: bigint | null;
|
|
107
|
+
email: string | null;
|
|
108
108
|
company_name: string | null;
|
|
109
109
|
id_number: string | null;
|
|
110
110
|
website: string | null;
|
|
@@ -124,13 +124,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
124
124
|
istrash: boolean | null;
|
|
125
125
|
accountid: bigint;
|
|
126
126
|
business_id: bigint;
|
|
127
|
-
email: string | null;
|
|
128
|
-
area_id: bigint | null;
|
|
129
|
-
state_id: bigint | null;
|
|
130
127
|
address_1: string | null;
|
|
131
128
|
address_2: string | null;
|
|
132
|
-
country_id: bigint | null;
|
|
133
129
|
postcode: string | null;
|
|
130
|
+
state_id: bigint | null;
|
|
131
|
+
country_id: bigint | null;
|
|
132
|
+
area_id: bigint | null;
|
|
133
|
+
email: string | null;
|
|
134
134
|
company_name: string | null;
|
|
135
135
|
id_number: string | null;
|
|
136
136
|
website: string | null;
|
|
@@ -146,13 +146,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
146
146
|
istrash: boolean | null;
|
|
147
147
|
accountid: bigint;
|
|
148
148
|
business_id: bigint;
|
|
149
|
-
email: string | null;
|
|
150
|
-
area_id: bigint | null;
|
|
151
|
-
state_id: bigint | null;
|
|
152
149
|
address_1: string | null;
|
|
153
150
|
address_2: string | null;
|
|
154
|
-
country_id: bigint | null;
|
|
155
151
|
postcode: string | null;
|
|
152
|
+
state_id: bigint | null;
|
|
153
|
+
country_id: bigint | null;
|
|
154
|
+
area_id: bigint | null;
|
|
155
|
+
email: string | null;
|
|
156
156
|
company_name: string | null;
|
|
157
157
|
id_number: string | null;
|
|
158
158
|
website: string | null;
|
|
@@ -162,7 +162,7 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
162
162
|
where?: Record<string, any>;
|
|
163
163
|
}) => Promise<number>;
|
|
164
164
|
aggregate: ({ field, operation, where, }: {
|
|
165
|
-
field: "status" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "business_id" | "
|
|
165
|
+
field: "status" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "business_id" | "address_1" | "address_2" | "postcode" | "state_id" | "country_id" | "area_id" | "email" | "company_name" | "id_number" | "website" | "company_contact";
|
|
166
166
|
operation?: "sum" | "avg" | "min" | "max" | "count";
|
|
167
167
|
where?: Record<string, any>;
|
|
168
168
|
}) => Promise<number>;
|
|
@@ -179,13 +179,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
179
179
|
istrash: boolean | null;
|
|
180
180
|
accountid: bigint;
|
|
181
181
|
business_id: bigint;
|
|
182
|
-
email: string | null;
|
|
183
|
-
area_id: bigint | null;
|
|
184
|
-
state_id: bigint | null;
|
|
185
182
|
address_1: string | null;
|
|
186
183
|
address_2: string | null;
|
|
187
|
-
country_id: bigint | null;
|
|
188
184
|
postcode: string | null;
|
|
185
|
+
state_id: bigint | null;
|
|
186
|
+
country_id: bigint | null;
|
|
187
|
+
area_id: bigint | null;
|
|
188
|
+
email: string | null;
|
|
189
189
|
company_name: string | null;
|
|
190
190
|
id_number: string | null;
|
|
191
191
|
website: string | null;
|
|
@@ -202,13 +202,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
202
202
|
istrash: boolean | null;
|
|
203
203
|
accountid: bigint;
|
|
204
204
|
business_id: bigint;
|
|
205
|
-
email: string | null;
|
|
206
|
-
area_id: bigint | null;
|
|
207
|
-
state_id: bigint | null;
|
|
208
205
|
address_1: string | null;
|
|
209
206
|
address_2: string | null;
|
|
210
|
-
country_id: bigint | null;
|
|
211
207
|
postcode: string | null;
|
|
208
|
+
state_id: bigint | null;
|
|
209
|
+
country_id: bigint | null;
|
|
210
|
+
area_id: bigint | null;
|
|
211
|
+
email: string | null;
|
|
212
212
|
company_name: string | null;
|
|
213
213
|
id_number: string | null;
|
|
214
214
|
website: string | null;
|
|
@@ -227,13 +227,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
227
227
|
istrash: boolean | null;
|
|
228
228
|
accountid: bigint;
|
|
229
229
|
business_id: bigint;
|
|
230
|
-
email: string | null;
|
|
231
|
-
area_id: bigint | null;
|
|
232
|
-
state_id: bigint | null;
|
|
233
230
|
address_1: string | null;
|
|
234
231
|
address_2: string | null;
|
|
235
|
-
country_id: bigint | null;
|
|
236
232
|
postcode: string | null;
|
|
233
|
+
state_id: bigint | null;
|
|
234
|
+
country_id: bigint | null;
|
|
235
|
+
area_id: bigint | null;
|
|
236
|
+
email: string | null;
|
|
237
237
|
company_name: string | null;
|
|
238
238
|
id_number: string | null;
|
|
239
239
|
website: string | null;
|
|
@@ -251,13 +251,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
251
251
|
istrash: boolean | null;
|
|
252
252
|
accountid: bigint;
|
|
253
253
|
business_id: bigint;
|
|
254
|
-
email: string | null;
|
|
255
|
-
area_id: bigint | null;
|
|
256
|
-
state_id: bigint | null;
|
|
257
254
|
address_1: string | null;
|
|
258
255
|
address_2: string | null;
|
|
259
|
-
country_id: bigint | null;
|
|
260
256
|
postcode: string | null;
|
|
257
|
+
state_id: bigint | null;
|
|
258
|
+
country_id: bigint | null;
|
|
259
|
+
area_id: bigint | null;
|
|
260
|
+
email: string | null;
|
|
261
261
|
company_name: string | null;
|
|
262
262
|
id_number: string | null;
|
|
263
263
|
website: string | null;
|
|
@@ -275,13 +275,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
275
275
|
istrash: boolean | null;
|
|
276
276
|
accountid: bigint;
|
|
277
277
|
business_id: bigint;
|
|
278
|
-
email: string | null;
|
|
279
|
-
area_id: bigint | null;
|
|
280
|
-
state_id: bigint | null;
|
|
281
278
|
address_1: string | null;
|
|
282
279
|
address_2: string | null;
|
|
283
|
-
country_id: bigint | null;
|
|
284
280
|
postcode: string | null;
|
|
281
|
+
state_id: bigint | null;
|
|
282
|
+
country_id: bigint | null;
|
|
283
|
+
area_id: bigint | null;
|
|
284
|
+
email: string | null;
|
|
285
285
|
company_name: string | null;
|
|
286
286
|
id_number: string | null;
|
|
287
287
|
website: string | null;
|
|
@@ -300,13 +300,13 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
300
300
|
istrash: boolean | null;
|
|
301
301
|
accountid: bigint;
|
|
302
302
|
business_id: bigint;
|
|
303
|
-
email: string | null;
|
|
304
|
-
area_id: bigint | null;
|
|
305
|
-
state_id: bigint | null;
|
|
306
303
|
address_1: string | null;
|
|
307
304
|
address_2: string | null;
|
|
308
|
-
country_id: bigint | null;
|
|
309
305
|
postcode: string | null;
|
|
306
|
+
state_id: bigint | null;
|
|
307
|
+
country_id: bigint | null;
|
|
308
|
+
area_id: bigint | null;
|
|
309
|
+
email: string | null;
|
|
310
310
|
company_name: string | null;
|
|
311
311
|
id_number: string | null;
|
|
312
312
|
website: string | null;
|