@hed-hog/contact 0.0.134 → 0.0.146

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 (77) hide show
  1. package/dist/address-type/address-type.controller.d.ts +5 -5
  2. package/dist/address-type/address-type.controller.d.ts.map +1 -1
  3. package/dist/address-type/address-type.controller.js +17 -13
  4. package/dist/address-type/address-type.controller.js.map +1 -1
  5. package/dist/address-type/address-type.service.d.ts +5 -5
  6. package/dist/address-type/address-type.service.d.ts.map +1 -1
  7. package/dist/address-type/address-type.service.js +32 -4
  8. package/dist/address-type/address-type.service.js.map +1 -1
  9. package/dist/address-type/dto/create.dto.d.ts +4 -2
  10. package/dist/address-type/dto/create.dto.d.ts.map +1 -1
  11. package/dist/address-type/dto/create.dto.js +10 -1
  12. package/dist/address-type/dto/create.dto.js.map +1 -1
  13. package/dist/address-type/dto/update.dto.d.ts +3 -0
  14. package/dist/address-type/dto/update.dto.d.ts.map +1 -1
  15. package/dist/address-type/dto/update.dto.js +15 -0
  16. package/dist/address-type/dto/update.dto.js.map +1 -1
  17. package/dist/contact-type/contact-type.controller.d.ts +5 -5
  18. package/dist/contact-type/contact-type.controller.d.ts.map +1 -1
  19. package/dist/contact-type/contact-type.controller.js +16 -12
  20. package/dist/contact-type/contact-type.controller.js.map +1 -1
  21. package/dist/contact-type/contact-type.service.d.ts +5 -5
  22. package/dist/contact-type/contact-type.service.d.ts.map +1 -1
  23. package/dist/contact-type/contact-type.service.js +34 -4
  24. package/dist/contact-type/contact-type.service.js.map +1 -1
  25. package/dist/contact-type/dto/create.dto.d.ts +4 -2
  26. package/dist/contact-type/dto/create.dto.d.ts.map +1 -1
  27. package/dist/contact-type/dto/create.dto.js +10 -1
  28. package/dist/contact-type/dto/create.dto.js.map +1 -1
  29. package/dist/contact-type/dto/update.dto.d.ts +3 -0
  30. package/dist/contact-type/dto/update.dto.d.ts.map +1 -1
  31. package/dist/contact-type/dto/update.dto.js +15 -0
  32. package/dist/contact-type/dto/update.dto.js.map +1 -1
  33. package/dist/document-type/document-type.controller.d.ts +5 -5
  34. package/dist/document-type/document-type.controller.d.ts.map +1 -1
  35. package/dist/document-type/document-type.controller.js +16 -12
  36. package/dist/document-type/document-type.controller.js.map +1 -1
  37. package/dist/document-type/document-type.service.d.ts +5 -5
  38. package/dist/document-type/document-type.service.d.ts.map +1 -1
  39. package/dist/document-type/document-type.service.js +34 -4
  40. package/dist/document-type/document-type.service.js.map +1 -1
  41. package/dist/document-type/dto/create.dto.d.ts +4 -2
  42. package/dist/document-type/dto/create.dto.d.ts.map +1 -1
  43. package/dist/document-type/dto/create.dto.js +10 -1
  44. package/dist/document-type/dto/create.dto.js.map +1 -1
  45. package/dist/document-type/dto/update.dto.d.ts +3 -0
  46. package/dist/document-type/dto/update.dto.d.ts.map +1 -1
  47. package/dist/document-type/dto/update.dto.js +15 -0
  48. package/dist/document-type/dto/update.dto.js.map +1 -1
  49. package/dist/person/address/address.controller.d.ts +1 -1
  50. package/dist/person/address/address.service.d.ts +1 -1
  51. package/dist/person/contact/contact.controller.d.ts +1 -1
  52. package/dist/person/contact/contact.service.d.ts +1 -1
  53. package/dist/person/document/document.controller.d.ts +1 -1
  54. package/dist/person/document/document.service.d.ts +1 -1
  55. package/dist/person/person-metadata/person-metadata.controller.d.ts +1 -1
  56. package/dist/person/person-metadata/person-metadata.service.d.ts +1 -1
  57. package/dist/person/person-relation/person-relation.controller.d.ts +1 -1
  58. package/dist/person/person-relation/person-relation.service.d.ts +1 -1
  59. package/dist/person/person.controller.d.ts +1 -1
  60. package/dist/person/person.service.d.ts +1 -1
  61. package/dist/person-relation-type/person-relation-type.controller.d.ts +1 -1
  62. package/dist/person-relation-type/person-relation-type.service.d.ts +1 -1
  63. package/package.json +5 -5
  64. package/src/address-type/address-type.controller.ts +8 -8
  65. package/src/address-type/address-type.service.ts +55 -8
  66. package/src/address-type/dto/create.dto.ts +12 -3
  67. package/src/address-type/dto/update.dto.ts +6 -1
  68. package/src/contact-type/contact-type.controller.ts +8 -8
  69. package/src/contact-type/contact-type.service.ts +57 -8
  70. package/src/contact-type/dto/create.dto.ts +12 -3
  71. package/src/contact-type/dto/update.dto.ts +6 -1
  72. package/src/document-type/document-type.controller.ts +8 -8
  73. package/src/document-type/document-type.service.ts +56 -8
  74. package/src/document-type/dto/create.dto.ts +12 -3
  75. package/src/document-type/dto/update.dto.ts +6 -1
  76. package/src/language/en.json +7 -0
  77. package/src/language/pt.json +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"document-type.controller.d.ts","sourceRoot":"","sources":["../../src/document-type/document-type.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAe/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAEa,4BAA4B;IAGrC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAIjE,IAAI,CAAW,MAAM,KAAA,EAAgB,gBAAgB,KAAA;;;;;;;;;IAKrD,GAAG,CAA4B,EAAE,EAAE,MAAM;IAKzC,MAAM,CAAS,IAAI,EAAE,SAAS;IAK9B,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS;IAQrE,MAAM,CAAS,IAAI,EAAE,SAAS;CAGrC"}
1
+ {"version":3,"file":"document-type.controller.d.ts","sourceRoot":"","sources":["../../src/document-type/document-type.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAe/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAEa,4BAA4B;IAGrC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;gBAAzB,yBAAyB,EAAE,yBAAyB;IAIjE,IAAI,CAAW,MAAM,KAAA,EAAgB,gBAAgB,KAAA;;;;;;;;;IAKrD,GAAG,CAA4B,EAAE,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM;IAKnE,MAAM,CAAS,IAAI,EAAE,SAAS,EAAY,MAAM,EAAE,MAAM;IAKxD,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,IAAI,EAAE,SAAS,EAAY,MAAM,EAAE,MAAM;IAQ/F,MAAM,CAAS,IAAI,EAAE,SAAS,EAAY,MAAM,EAAE,MAAM;CAG/D"}
@@ -27,20 +27,20 @@ let PersonDocumentTypeController = class PersonDocumentTypeController {
27
27
  async list(locale, paginationParams) {
28
28
  return this.personDocumentTypeService.list(locale, paginationParams);
29
29
  }
30
- async get(id) {
31
- return this.personDocumentTypeService.get(id);
30
+ async get(id, locale) {
31
+ return this.personDocumentTypeService.get(id, locale);
32
32
  }
33
- async create(data) {
34
- return this.personDocumentTypeService.create(data);
33
+ async create(data, locale) {
34
+ return this.personDocumentTypeService.create(data, locale);
35
35
  }
36
- async update(id, data) {
36
+ async update(id, data, locale) {
37
37
  return this.personDocumentTypeService.update({
38
38
  id,
39
39
  data
40
- });
40
+ }, locale);
41
41
  }
42
- async delete(data) {
43
- return this.personDocumentTypeService.delete(data);
42
+ async delete(data, locale) {
43
+ return this.personDocumentTypeService.delete(data, locale);
44
44
  }
45
45
  };
46
46
  exports.PersonDocumentTypeController = PersonDocumentTypeController;
@@ -55,30 +55,34 @@ __decorate([
55
55
  __decorate([
56
56
  (0, common_1.Get)(':id'),
57
57
  __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
58
+ __param(1, (0, api_locale_1.Locale)()),
58
59
  __metadata("design:type", Function),
59
- __metadata("design:paramtypes", [Number]),
60
+ __metadata("design:paramtypes", [Number, String]),
60
61
  __metadata("design:returntype", Promise)
61
62
  ], PersonDocumentTypeController.prototype, "get", null);
62
63
  __decorate([
63
64
  (0, common_1.Post)(),
64
65
  __param(0, (0, common_1.Body)()),
66
+ __param(1, (0, api_locale_1.Locale)()),
65
67
  __metadata("design:type", Function),
66
- __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
68
+ __metadata("design:paramtypes", [create_dto_1.CreateDTO, String]),
67
69
  __metadata("design:returntype", Promise)
68
70
  ], PersonDocumentTypeController.prototype, "create", null);
69
71
  __decorate([
70
72
  (0, common_1.Patch)(':id'),
71
73
  __param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
72
74
  __param(1, (0, common_1.Body)()),
75
+ __param(2, (0, api_locale_1.Locale)()),
73
76
  __metadata("design:type", Function),
74
- __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO]),
77
+ __metadata("design:paramtypes", [Number, update_dto_1.UpdateDTO, String]),
75
78
  __metadata("design:returntype", Promise)
76
79
  ], PersonDocumentTypeController.prototype, "update", null);
77
80
  __decorate([
78
81
  (0, common_1.Delete)(),
79
82
  __param(0, (0, common_1.Body)()),
83
+ __param(1, (0, api_locale_1.Locale)()),
80
84
  __metadata("design:type", Function),
81
- __metadata("design:paramtypes", [api_1.DeleteDTO]),
85
+ __metadata("design:paramtypes", [api_1.DeleteDTO, String]),
82
86
  __metadata("design:returntype", Promise)
83
87
  ], PersonDocumentTypeController.prototype, "delete", null);
84
88
  exports.PersonDocumentTypeController = PersonDocumentTypeController = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"document-type.controller.js","sourceRoot":"","sources":["../../src/document-type/document-type.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA+C;AAC/C,oDAA6C;AAC7C,4DAAqD;AACrD,2CAWwB;AACxB,mEAAoE;AACpE,iDAA6C;AAC7C,iDAA6C;AAItC,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,yBAAoD;QAApD,8BAAyB,GAAzB,yBAAyB,CAA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IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,eAAS;;0DAEnC;uCAhCU,4BAA4B;IAFxC,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,sBAAsB,CAAC;IAG9B,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iDAAyB,CAAC,CAAC,CAAA;qCACR,iDAAyB;GAH5D,4BAA4B,CAiCxC"}
1
+ {"version":3,"file":"document-type.controller.js","sourceRoot":"","sources":["../../src/document-type/document-type.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA+C;AAC/C,oDAA6C;AAC7C,4DAAqD;AACrD,2CAWwB;AACxB,mEAAoE;AACpE,iDAA6C;AAC7C,iDAA6C;AAItC,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YAEmB,yBAAoD;QAApD,8BAAyB,GAAzB,yBAAyB,CAA2B;IACpE,CAAC;IAGE,AAAN,KAAK,CAAC,IAAI,CAAW,MAAM,EAAgB,gBAAgB;QACzD,OAAO,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACvE,CAAC;IAGK,AAAN,KAAK,CAAC,GAAG,CAA4B,EAAU,EAAY,MAAc;QACvE,OAAO,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe,EAAY,MAAc;QAC5D,OAAO,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAA4B,EAAU,EAAU,IAAe,EAAY,MAAc;QACnG,OAAO,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC;YAC3C,EAAE;YACF,IAAI;SACL,EAAE,MAAM,CAAC,CAAC;IACb,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe,EAAY,MAAc;QAC5D,OAAO,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF,CAAA;AAjCY,oEAA4B;AAOjC;IADL,IAAA,YAAG,GAAE;IACM,WAAA,IAAA,mBAAM,GAAE,CAAA;IAAU,WAAA,IAAA,2BAAU,GAAE,CAAA;;;;wDAEzC;AAGK;IADL,IAAA,YAAG,EAAC,KAAK,CAAC;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IAAc,WAAA,IAAA,mBAAM,GAAE,CAAA;;;;uDAEzD;AAGK;IADL,IAAA,aAAI,GAAE;IACO,WAAA,IAAA,aAAI,GAAE,CAAA;IAAmB,WAAA,IAAA,mBAAM,GAAE,CAAA;;qCAApB,sBAAS;;0DAEnC;AAGK;IADL,IAAA,cAAK,EAAC,KAAK,CAAC;IACC,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;IAAmB,WAAA,IAAA,mBAAM,GAAE,CAAA;;6CAApB,sBAAS;;0DAK1E;AAGK;IADL,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;IAAmB,WAAA,IAAA,mBAAM,GAAE,CAAA;;qCAApB,eAAS;;0DAEnC;uCAhCU,4BAA4B;IAFxC,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,sBAAsB,CAAC;IAG9B,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iDAAyB,CAAC,CAAC,CAAA;qCACR,iDAAyB;GAH5D,4BAA4B,CAiCxC"}
@@ -17,14 +17,14 @@ export declare class PersonDocumentTypeService {
17
17
  pageSize: number;
18
18
  prev: number;
19
19
  next: number;
20
- data: any;
20
+ data: any[];
21
21
  }>;
22
- get(id: number): Promise<any>;
23
- create(data: CreateDTO): Promise<any>;
22
+ get(id: number, locale: string): Promise<any>;
23
+ create(data: CreateDTO, locale: string): Promise<any>;
24
24
  update({ id, data }: {
25
25
  id: number;
26
26
  data: UpdateDTO;
27
- }): Promise<any>;
28
- delete({ ids }: DeleteDTO, locale?: string): Promise<import("@prisma/client").Prisma.BatchPayload>;
27
+ }, locale: string): Promise<any>;
28
+ delete({ ids }: DeleteDTO, locale: string): Promise<import("@prisma/client").Prisma.BatchPayload>;
29
29
  }
30
30
  //# sourceMappingURL=document-type.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-type.service.d.ts","sourceRoot":"","sources":["../../src/document-type/document-type.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAiB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,yBAAyB;IAMlC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAPhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;gBAI9B,aAAa,EAAE,aAAa,EAE5B,aAAa,EAAE,aAAa;IAGzC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;;;;;;;;;IAQpD,GAAG,CAAC,EAAE,EAAE,MAAM;IAId,MAAM,CAAC,IAAI,EAAE,SAAS;IAQtB,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IASpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,GAAE,MAAa;CAmBvD"}
1
+ {"version":3,"file":"document-type.service.d.ts","sourceRoot":"","sources":["../../src/document-type/document-type.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAiB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,yBAAyB;IAMlC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAPhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;gBAI9B,aAAa,EAAE,aAAa,EAE5B,aAAa,EAAE,aAAa;IAGzC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa;;;;;;;;;IAQpD,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAc9B,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;IActC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,EAAE,MAAM,EAAE,MAAM;IAwBpE,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;CAmChD"}
@@ -26,19 +26,49 @@ let PersonDocumentTypeService = class PersonDocumentTypeService {
26
26
  async list(locale, paginationParams) {
27
27
  return this.localeService.listModelWithLocale(locale, this.modelName, paginationParams);
28
28
  }
29
- async get(id) {
29
+ async get(id, locale) {
30
+ const documentType = await this.prismaService.document_type.findUnique({
31
+ where: { id }
32
+ });
33
+ if (!documentType) {
34
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('documentTypeNotFound', locale, `Document Type with ID ${id} not found`).replace('{{item}}', 'Document Type'));
35
+ }
30
36
  return this.localeService.getModelWithLocale(this.modelName, id);
31
37
  }
32
- async create(data) {
38
+ async create(data, locale) {
39
+ if (!data.locale || Object.keys(data.locale).length === 0) {
40
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('localeRequired', locale, 'At least one locale is required'));
41
+ }
33
42
  return this.localeService.createModelWithLocale(this.modelName, this.foreignKey, data);
34
43
  }
35
- async update({ id, data }) {
44
+ async update({ id, data }, locale) {
45
+ const documentTypeExists = await this.prismaService.document_type.findUnique({
46
+ where: { id }
47
+ });
48
+ if (!documentTypeExists) {
49
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('documentTypeNotFound', locale, `Document Type with ID ${id} not found`).replace('{{item}}', 'Document Type'));
50
+ }
51
+ if (data.locale && Object.keys(data.locale).length === 0) {
52
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('localeRequired', locale, 'At least one locale is required'));
53
+ }
36
54
  return this.localeService.updateModelWithLocale(this.modelName, this.foreignKey, id, data);
37
55
  }
38
- async delete({ ids }, locale = 'en') {
56
+ async delete({ ids }, locale) {
39
57
  if (ids == undefined || ids == null) {
40
58
  throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('deleteItemsRequired', locale, 'You must select at least one item to delete.'));
41
59
  }
60
+ const existingDocumentTypes = await this.prismaService.document_type.findMany({
61
+ where: {
62
+ id: {
63
+ in: ids,
64
+ },
65
+ },
66
+ });
67
+ if (existingDocumentTypes.length !== ids.length) {
68
+ const existingIds = existingDocumentTypes.map((item) => item.id);
69
+ const missingIds = ids.filter((id) => !existingIds.includes(id));
70
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('documentTypesNotFound', locale, `Document Types with IDs ${missingIds.join(', ')} not found`).replace('{{items}}', 'Document Types'));
71
+ }
42
72
  return this.prismaService.document_type.deleteMany({
43
73
  where: {
44
74
  id: {
@@ -1 +1 @@
1
- {"version":3,"file":"document-type.service.js","sourceRoot":"","sources":["../../src/document-type/document-type.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,oDAAmE;AAEnE,oDAAoD;AACpD,2CAKwB;AAKjB,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAIpC,YAEE,aAA6C,EAE7C,aAA6C;QAF5B,kBAAa,GAAb,aAAa,CAAe;QAE5B,kBAAa,GAAb,aAAa,CAAe;QAP9B,cAAS,GAAG,eAAe,CAAC;QAC5B,eAAU,GAAG,kBAAkB,CAAC;IAO9C,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,MAAc,EAAE,gBAA+B;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAC3C,MAAM,EACN,IAAI,CAAC,SAAS,EACd,gBAAgB,CACjB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAe;QAC1B,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAC7C,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,UAAU,EACf,IAAI,CACL,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAmC;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAC7C,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,UAAU,EACf,EAAE,EACF,IAAI,CACL,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAa,EAAE,SAAiB,IAAI;QACpD,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAC3B,IAAA,0BAAa,EACX,qBAAqB,EACrB,MAAM,EACN,8CAA8C,CAC/C,CACF,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC;YACjD,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA3DY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;qCADR,0BAAa;QAEb,0BAAa;GARpC,yBAAyB,CA2DrC"}
1
+ {"version":3,"file":"document-type.service.js","sourceRoot":"","sources":["../../src/document-type/document-type.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,oDAAmE;AAEnE,oDAAoD;AACpD,2CAMwB;AAKjB,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAIpC,YAEE,aAA6C,EAE7C,aAA6C;QAF5B,kBAAa,GAAb,aAAa,CAAe;QAE5B,kBAAa,GAAb,aAAa,CAAe;QAP9B,cAAS,GAAG,eAAe,CAAC;QAC5B,eAAU,GAAG,kBAAkB,CAAC;IAO9C,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,MAAc,EAAE,gBAA+B;QACxD,OAAO,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAC3C,MAAM,EACN,IAAI,CAAC,SAAS,EACd,gBAAgB,CACjB,CAAC;IACJ,CAAC;IAED,KAAK,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C,uBAAuB,EAAE,MAAM,EAAE,2BAA2B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,gBAAgB,CAAC,CACpJ,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC;YACjD,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA1GY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;qCADR,0BAAa;QAEb,0BAAa;GARpC,yBAAyB,CA0GrC"}
@@ -1,7 +1,9 @@
1
- import { WithLocaleDTO } from '@hed-hog/api-locale';
2
- export declare class CreateDTO extends WithLocaleDTO {
1
+ export declare class CreateDTO {
3
2
  code: string;
4
3
  country_code: string;
5
4
  is_unique: boolean;
5
+ locale: Record<string, {
6
+ name: string;
7
+ }>;
6
8
  }
7
9
  //# sourceMappingURL=create.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/document-type/dto/create.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGnE,qBAAa,SAAU,SAAQ,aAAa;IAK1C,IAAI,EAAE,MAAM,CAAC;IAMb,YAAY,EAAE,MAAM,CAAC;IAGrB,SAAS,EAAE,OAAO,CAAC;CACpB"}
1
+ {"version":3,"file":"create.dto.d.ts","sourceRoot":"","sources":["../../../src/document-type/dto/create.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IAKpB,IAAI,EAAE,MAAM,CAAC;IAMb,YAAY,EAAE,MAAM,CAAC;IAGrB,SAAS,EAAE,OAAO,CAAC;IASnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1C"}
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateDTO = void 0;
13
13
  const api_locale_1 = require("@hed-hog/api-locale");
14
14
  const class_validator_1 = require("class-validator");
15
- class CreateDTO extends api_locale_1.WithLocaleDTO {
15
+ class CreateDTO {
16
16
  }
17
17
  exports.CreateDTO = CreateDTO;
18
18
  __decorate([
@@ -31,4 +31,13 @@ __decorate([
31
31
  (0, class_validator_1.IsBoolean)(),
32
32
  __metadata("design:type", Boolean)
33
33
  ], CreateDTO.prototype, "is_unique", void 0);
34
+ __decorate([
35
+ (0, class_validator_1.IsObject)({
36
+ message: (args) => (0, api_locale_1.getLocaleText)('validation.localeMustBeObject', args.value),
37
+ }),
38
+ (0, class_validator_1.IsNotEmpty)({
39
+ message: (args) => (0, api_locale_1.getLocaleText)('validation.localeRequired', args.value),
40
+ }),
41
+ __metadata("design:type", Object)
42
+ ], CreateDTO.prototype, "locale", void 0);
34
43
  //# sourceMappingURL=create.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/document-type/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmE;AACnE,qDAAsD;AAEtD,MAAa,SAAU,SAAQ,0BAAa;CAe3C;AAfD,8BAeC;AAVC;IAJC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,6BAA6B,EAAE,IAAI,CAAC,KAAK,CAAC;KAC3D,CAAC;;uCACW;AAMb;IAJC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,oCAAoC,EAAE,IAAI,CAAC,KAAK,CAAC;KAClE,CAAC;;+CACmB;AAGrB;IADC,IAAA,2BAAS,GAAE;;4CACO"}
1
+ {"version":3,"file":"create.dto.js","sourceRoot":"","sources":["../../../src/document-type/dto/create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,qDAA4E;AAE5E,MAAa,SAAS;CAwBrB;AAxBD,8BAwBC;AAnBC;IAJC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,6BAA6B,EAAE,IAAI,CAAC,KAAK,CAAC;KAC3D,CAAC;;uCACW;AAMb;IAJC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,oCAAoC,EAAE,IAAI,CAAC,KAAK,CAAC;KAClE,CAAC;;+CACmB;AAGrB;IADC,IAAA,2BAAS,GAAE;;4CACO;AASnB;IAPC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,+BAA+B,EAAE,IAAI,CAAC,KAAK,CAAC;KAC7D,CAAC;IACD,IAAA,4BAAU,EAAC;QACV,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,2BAA2B,EAAE,IAAI,CAAC,KAAK,CAAC;KAC1E,CAAC;;yCACuC"}
@@ -1,6 +1,9 @@
1
1
  import { CreateDTO } from './create.dto';
2
2
  declare const UpdateDTO_base: import("@nestjs/mapped-types").MappedType<Partial<CreateDTO>>;
3
3
  export declare class UpdateDTO extends UpdateDTO_base {
4
+ locale?: Record<string, {
5
+ name: string;
6
+ }>;
4
7
  }
5
8
  export {};
6
9
  //# sourceMappingURL=update.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/document-type/dto/update.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;AAEzC,qBAAa,SAAU,SAAQ,cAAsB;CAAG"}
1
+ {"version":3,"file":"update.dto.d.ts","sourceRoot":"","sources":["../../../src/document-type/dto/update.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;AAEzC,qBAAa,SAAU,SAAQ,cAAsB;IAGnD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3C"}
@@ -1,9 +1,24 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.UpdateDTO = void 0;
4
13
  const mapped_types_1 = require("@nestjs/mapped-types");
14
+ const class_validator_1 = require("class-validator");
5
15
  const create_dto_1 = require("./create.dto");
6
16
  class UpdateDTO extends (0, mapped_types_1.PartialType)(create_dto_1.CreateDTO) {
7
17
  }
8
18
  exports.UpdateDTO = UpdateDTO;
19
+ __decorate([
20
+ (0, class_validator_1.IsOptional)(),
21
+ (0, class_validator_1.IsObject)(),
22
+ __metadata("design:type", Object)
23
+ ], UpdateDTO.prototype, "locale", void 0);
9
24
  //# sourceMappingURL=update.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/document-type/dto/update.dto.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,6CAAyC;AAEzC,MAAa,SAAU,SAAQ,IAAA,0BAAW,EAAC,sBAAS,CAAC;CAAG;AAAxD,8BAAwD"}
1
+ {"version":3,"file":"update.dto.js","sourceRoot":"","sources":["../../../src/document-type/dto/update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAmD;AACnD,qDAAuD;AACvD,6CAAyC;AAEzC,MAAa,SAAU,SAAQ,IAAA,0BAAW,EAAC,sBAAS,CAAC;CAIpD;AAJD,8BAIC;AADC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;yCAC+B"}
@@ -26,7 +26,7 @@ export declare class PersonAddressController {
26
26
  pageSize: number;
27
27
  prev: number;
28
28
  next: number;
29
- data: any;
29
+ data: any[];
30
30
  }>;
31
31
  get(personId: number, id: number): Promise<{
32
32
  id: number;
@@ -42,7 +42,7 @@ export declare class PersonAddressService {
42
42
  pageSize: number;
43
43
  prev: number;
44
44
  next: number;
45
- data: any;
45
+ data: any[];
46
46
  }>;
47
47
  update(personId: number, id: number, data: UpdateDTO): Promise<import("@prisma/client").Prisma.BatchPayload>;
48
48
  delete(personId: number, { ids }: DeleteDTO, locale?: string): Promise<import("@prisma/client").Prisma.BatchPayload>;
@@ -21,7 +21,7 @@ export declare class PersonContactController {
21
21
  pageSize: number;
22
22
  prev: number;
23
23
  next: number;
24
- data: any;
24
+ data: any[];
25
25
  }>;
26
26
  get(personId: number, id: number): Promise<{
27
27
  value: string;
@@ -32,7 +32,7 @@ export declare class PersonContactService {
32
32
  pageSize: number;
33
33
  prev: number;
34
34
  next: number;
35
- data: any;
35
+ data: any[];
36
36
  }>;
37
37
  update(personId: number, id: number, data: UpdateDTO): Promise<import("@prisma/client").Prisma.BatchPayload>;
38
38
  delete(personId: number, { ids }: DeleteDTO, locale?: string): Promise<import("@prisma/client").Prisma.BatchPayload>;
@@ -20,7 +20,7 @@ export declare class PersonDocumentController {
20
20
  pageSize: number;
21
21
  prev: number;
22
22
  next: number;
23
- data: any;
23
+ data: any[];
24
24
  }>;
25
25
  get(personId: number, id: number): Promise<{
26
26
  value: string;
@@ -30,7 +30,7 @@ export declare class PersonDocumentService {
30
30
  pageSize: number;
31
31
  prev: number;
32
32
  next: number;
33
- data: any;
33
+ data: any[];
34
34
  }>;
35
35
  update(personId: number, id: number, data: UpdateDTO): Promise<import("@prisma/client").Prisma.BatchPayload>;
36
36
  delete(personId: number, { ids }: DeleteDTO, locale?: string): Promise<import("@prisma/client").Prisma.BatchPayload>;
@@ -20,7 +20,7 @@ export declare class PersonMetadataController {
20
20
  pageSize: number;
21
21
  prev: number;
22
22
  next: number;
23
- data: any;
23
+ data: any[];
24
24
  }>;
25
25
  get(personId: number, id: number): Promise<{
26
26
  value: import("@prisma/client/runtime/library").JsonValue;
@@ -30,7 +30,7 @@ export declare class PersonMetadataService {
30
30
  pageSize: number;
31
31
  prev: number;
32
32
  next: number;
33
- data: any;
33
+ data: any[];
34
34
  }>;
35
35
  update(personId: number, id: number, data: UpdateDTO): Promise<import("@prisma/client").Prisma.BatchPayload>;
36
36
  delete(personId: number, { ids }: DeleteDTO, locale?: string): Promise<import("@prisma/client").Prisma.BatchPayload>;
@@ -20,7 +20,7 @@ export declare class PersonRelationController {
20
20
  pageSize: number;
21
21
  prev: number;
22
22
  next: number;
23
- data: any;
23
+ data: any[];
24
24
  }>;
25
25
  get(personId: number, id: number): Promise<{
26
26
  person_person_relation_related_person_idToperson: {
@@ -45,7 +45,7 @@ export declare class PersonRelationService {
45
45
  pageSize: number;
46
46
  prev: number;
47
47
  next: number;
48
- data: any;
48
+ data: any[];
49
49
  }>;
50
50
  update(personId: number, id: number, data: UpdateDTO): Promise<import("@prisma/client").Prisma.BatchPayload>;
51
51
  delete(personId: number, { ids }: DeleteDTO, locale?: string): Promise<import("@prisma/client").Prisma.BatchPayload>;
@@ -19,7 +19,7 @@ export declare class PersonController {
19
19
  pageSize: number;
20
20
  prev: number;
21
21
  next: number;
22
- data: any;
22
+ data: any[];
23
23
  }>;
24
24
  get(id: number, locale: string): Promise<{
25
25
  name: string;
@@ -23,7 +23,7 @@ export declare class PersonService {
23
23
  pageSize: number;
24
24
  prev: number;
25
25
  next: number;
26
- data: any;
26
+ data: any[];
27
27
  }>;
28
28
  get(id: number): Promise<{
29
29
  name: string;
@@ -12,7 +12,7 @@ export declare class PersonRelationTypeController {
12
12
  pageSize: number;
13
13
  prev: number;
14
14
  next: number;
15
- data: any;
15
+ data: any[];
16
16
  }>;
17
17
  get(id: number): Promise<any>;
18
18
  create(data: CreateDTO): Promise<any>;
@@ -18,7 +18,7 @@ export declare class PersonRelationTypeService {
18
18
  pageSize: number;
19
19
  prev: number;
20
20
  next: number;
21
- data: any;
21
+ data: any[];
22
22
  }>;
23
23
  get(id: number): Promise<any>;
24
24
  create(data: CreateDTO): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/contact",
3
- "version": "0.0.134",
3
+ "version": "0.0.146",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -11,10 +11,10 @@
11
11
  "@nestjs/mapped-types": "*",
12
12
  "@hed-hog/api-mail": "0.0.7",
13
13
  "@hed-hog/api-prisma": "0.0.4",
14
- "@hed-hog/core": "0.0.134",
15
- "@hed-hog/api": "0.0.3",
16
- "@hed-hog/api-locale": "0.0.10",
17
- "@hed-hog/api-pagination": "0.0.4"
14
+ "@hed-hog/api-locale": "0.0.11",
15
+ "@hed-hog/core": "0.0.145",
16
+ "@hed-hog/api-pagination": "0.0.5",
17
+ "@hed-hog/api": "0.0.3"
18
18
  },
19
19
  "exports": {
20
20
  ".": {
@@ -31,25 +31,25 @@ export class PersonAddressTypeController {
31
31
  }
32
32
 
33
33
  @Get(':id')
34
- async get(@Param('id', ParseIntPipe) id: number) {
35
- return this.personAddressTypeService.get(id);
34
+ async get(@Param('id', ParseIntPipe) id: number, @Locale() locale: string) {
35
+ return this.personAddressTypeService.get(id, locale);
36
36
  }
37
37
 
38
38
  @Post()
39
- async create(@Body() data: CreateDTO) {
40
- return this.personAddressTypeService.create(data);
39
+ async create(@Locale() locale: string, @Body() data: CreateDTO) {
40
+ return this.personAddressTypeService.create(data, locale);
41
41
  }
42
42
 
43
43
  @Patch(':id')
44
- async update(@Param('id', ParseIntPipe) id: number, @Body() data: UpdateDTO) {
44
+ async update(@Param('id', ParseIntPipe) id: number, @Body() data: UpdateDTO, @Locale() locale: string) {
45
45
  return this.personAddressTypeService.update({
46
46
  id,
47
47
  data
48
- });
48
+ }, locale);
49
49
  }
50
50
 
51
51
  @Delete()
52
- async delete(@Body() data: DeleteDTO) {
53
- return this.personAddressTypeService.delete(data);
52
+ async delete(@Body() data: DeleteDTO, @Locale() locale: string) {
53
+ return this.personAddressTypeService.delete(data, locale);
54
54
  }
55
55
  }
@@ -3,10 +3,11 @@ import { LocaleService, getLocaleText } from '@hed-hog/api-locale';
3
3
  import { PaginationDTO } from '@hed-hog/api-pagination';
4
4
  import { PrismaService } from '@hed-hog/api-prisma';
5
5
  import {
6
- BadRequestException,
7
- Inject,
8
- Injectable,
9
- forwardRef
6
+ BadRequestException,
7
+ Inject,
8
+ Injectable,
9
+ NotFoundException,
10
+ forwardRef
10
11
  } from '@nestjs/common';
11
12
  import { CreateDTO } from './dto/create.dto';
12
13
  import { UpdateDTO } from './dto/update.dto';
@@ -31,11 +32,25 @@ export class PersonAddressTypeService {
31
32
  );
32
33
  }
33
34
 
34
- async get(id: number) {
35
+ async get(id: number, locale: string) {
36
+ const addressType = await this.prismaService.address_type.findUnique({ where: { id }});
37
+
38
+ if (!addressType) {
39
+ throw new NotFoundException(
40
+ getLocaleText('addressTypeNotFound', locale, `Address Type with ID ${id} not found`).replace('{{item}}', 'Address Type')
41
+ );
42
+ }
43
+
35
44
  return this.localeService.getModelWithLocale(this.modelName, id);
36
45
  }
37
46
 
38
- async create(data: CreateDTO) {
47
+ async create(data: CreateDTO, locale: string) {
48
+ if (!data.locale || Object.keys(data.locale).length === 0) {
49
+ throw new BadRequestException(
50
+ getLocaleText('localeRequired', locale, 'At least one locale is required')
51
+ );
52
+ }
53
+
39
54
  return this.localeService.createModelWithLocale(
40
55
  this.modelName,
41
56
  this.foreignKey,
@@ -43,7 +58,23 @@ export class PersonAddressTypeService {
43
58
  );
44
59
  }
45
60
 
46
- async update({ id, data }: { id: number; data: UpdateDTO }) {
61
+ async update({ id, data }: { id: number; data: UpdateDTO }, locale: string) {
62
+ const addressTypeExists = await this.prismaService.address_type.findUnique({
63
+ where: { id }
64
+ });
65
+
66
+ if (!addressTypeExists) {
67
+ throw new NotFoundException(
68
+ getLocaleText('addressTypeNotFound', locale, `Address Type with ID ${id} not found`).replace('{{item}}', 'Address Type')
69
+ );
70
+ }
71
+
72
+ if (data.locale && Object.keys(data.locale).length === 0) {
73
+ throw new BadRequestException(
74
+ getLocaleText('localeRequired', locale, 'At least one locale is required')
75
+ );
76
+ }
77
+
47
78
  return this.localeService.updateModelWithLocale(
48
79
  this.modelName,
49
80
  this.foreignKey,
@@ -52,7 +83,7 @@ export class PersonAddressTypeService {
52
83
  );
53
84
  }
54
85
 
55
- async delete({ ids }: DeleteDTO, locale: string = 'en') {
86
+ async delete({ ids }: DeleteDTO, locale: string) {
56
87
  if (ids == undefined || ids == null) {
57
88
  throw new BadRequestException(
58
89
  getLocaleText(
@@ -63,6 +94,22 @@ export class PersonAddressTypeService {
63
94
  );
64
95
  }
65
96
 
97
+ const existingAddressTypes = await this.prismaService.address_type.findMany({
98
+ where: {
99
+ id: {
100
+ in: ids,
101
+ },
102
+ },
103
+ });
104
+
105
+ if (existingAddressTypes.length !== ids.length) {
106
+ const existingIds = existingAddressTypes.map((item) => item.id);
107
+ const missingIds = ids.filter((id) => !existingIds.includes(id));
108
+ throw new NotFoundException(
109
+ getLocaleText('addressTypesNotFound', locale, `Address Types with IDs ${missingIds.join(', ')} not found`).replace('{{items}}', 'Address Types')
110
+ );
111
+ }
112
+
66
113
  return this.prismaService.address_type.deleteMany({
67
114
  where: {
68
115
  id: {
@@ -1,10 +1,19 @@
1
- import { getLocaleText, WithLocaleDTO } from '@hed-hog/api-locale';
2
- import { IsString } from 'class-validator';
1
+ import { getLocaleText } from '@hed-hog/api-locale';
2
+ import { IsNotEmpty, IsObject, IsString } from 'class-validator';
3
3
 
4
- export class CreateDTO extends WithLocaleDTO {
4
+ export class CreateDTO {
5
5
  @IsString({
6
6
  message: (args) =>
7
7
  getLocaleText('validation.codeMustBeString', args.value),
8
8
  })
9
9
  code: string;
10
+
11
+ @IsObject({
12
+ message: (args) =>
13
+ getLocaleText('validation.localeMustBeObject', args.value),
14
+ })
15
+ @IsNotEmpty({
16
+ message: (args) => getLocaleText('validation.localeRequired', args.value),
17
+ })
18
+ locale: Record<string, { name: string }>;
10
19
  }
@@ -1,4 +1,9 @@
1
1
  import { PartialType } from '@nestjs/mapped-types';
2
+ import { IsObject, IsOptional } from 'class-validator';
2
3
  import { CreateDTO } from './create.dto';
3
4
 
4
- export class UpdateDTO extends PartialType(CreateDTO) {}
5
+ export class UpdateDTO extends PartialType(CreateDTO) {
6
+ @IsOptional()
7
+ @IsObject()
8
+ locale?: Record<string, { name: string }>;
9
+ }