@silexpert/core 0.4.102 → 0.4.103

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 (181) hide show
  1. package/es/api/resources/FecFile.d.ts +2 -2
  2. package/es/api/resources/FecFile.d.ts.map +1 -1
  3. package/es/api/resources/FecFile.js +2 -2
  4. package/es/api/resources/FecFile.js.map +1 -1
  5. package/es/api/resources/PartneredAccountant.d.ts +4 -1
  6. package/es/api/resources/PartneredAccountant.d.ts.map +1 -1
  7. package/es/api/resources/PartneredAccountant.js +6 -0
  8. package/es/api/resources/PartneredAccountant.js.map +1 -1
  9. package/es/api/resources/Product.d.ts +10 -0
  10. package/es/api/resources/Product.d.ts.map +1 -0
  11. package/es/api/resources/Product.js +21 -0
  12. package/es/api/resources/Product.js.map +1 -0
  13. package/es/api/resources/Society.d.ts +3 -1
  14. package/es/api/resources/Society.d.ts.map +1 -1
  15. package/es/api/resources/Society.js +7 -0
  16. package/es/api/resources/Society.js.map +1 -1
  17. package/es/types/Enum/ProductType.d.ts +6 -0
  18. package/es/types/Enum/ProductType.d.ts.map +1 -0
  19. package/es/types/Enum/ProductType.js +7 -0
  20. package/es/types/Enum/ProductType.js.map +1 -0
  21. package/es/types/Enum/RegistrationSource.d.ts +5 -0
  22. package/es/types/Enum/RegistrationSource.d.ts.map +1 -0
  23. package/es/types/Enum/RegistrationSource.js +6 -0
  24. package/es/types/Enum/RegistrationSource.js.map +1 -0
  25. package/es/types/Enum/Unit.d.ts +9 -0
  26. package/es/types/Enum/Unit.d.ts.map +1 -0
  27. package/es/types/Enum/Unit.js +98 -0
  28. package/es/types/Enum/Unit.js.map +1 -0
  29. package/es/types/Interface/api/BasePaginate.d.ts +4 -0
  30. package/es/types/Interface/api/BasePaginate.d.ts.map +1 -1
  31. package/es/types/Interface/api/BasePaginate.js +27 -1
  32. package/es/types/Interface/api/BasePaginate.js.map +1 -1
  33. package/es/types/Interface/api/fecFile/QueryFecFile.d.ts +4 -0
  34. package/es/types/Interface/api/fecFile/QueryFecFile.d.ts.map +1 -0
  35. package/es/types/Interface/api/fecFile/QueryFecFile.js +17 -0
  36. package/es/types/Interface/api/fecFile/QueryFecFile.js.map +1 -0
  37. package/es/types/Interface/api/partneredAccountant/CreatePartneredAccountantSociety.d.ts +26 -0
  38. package/es/types/Interface/api/partneredAccountant/CreatePartneredAccountantSociety.d.ts.map +1 -0
  39. package/es/types/Interface/api/partneredAccountant/CreatePartneredAccountantSociety.js +96 -0
  40. package/es/types/Interface/api/partneredAccountant/CreatePartneredAccountantSociety.js.map +1 -0
  41. package/es/types/Interface/api/partneredAccountant/CreatedPartneredAccountantSociety.d.ts +6 -0
  42. package/es/types/Interface/api/partneredAccountant/CreatedPartneredAccountantSociety.d.ts.map +1 -0
  43. package/es/types/Interface/api/partneredAccountant/CreatedPartneredAccountantSociety.js +3 -0
  44. package/es/types/Interface/api/partneredAccountant/CreatedPartneredAccountantSociety.js.map +1 -0
  45. package/es/types/Interface/api/partneredAccountant/QueryPartneredAccountantSocieties.d.ts +4 -0
  46. package/es/types/Interface/api/partneredAccountant/QueryPartneredAccountantSocieties.d.ts.map +1 -0
  47. package/es/types/Interface/api/partneredAccountant/QueryPartneredAccountantSocieties.js +22 -0
  48. package/es/types/Interface/api/partneredAccountant/QueryPartneredAccountantSocieties.js.map +1 -0
  49. package/es/types/Interface/api/partneredAccountant/ReadPartneredAccountantSociety.d.ts +6 -0
  50. package/es/types/Interface/api/partneredAccountant/ReadPartneredAccountantSociety.d.ts.map +1 -0
  51. package/es/types/Interface/api/partneredAccountant/ReadPartneredAccountantSociety.js +2 -0
  52. package/es/types/Interface/api/partneredAccountant/ReadPartneredAccountantSociety.js.map +1 -0
  53. package/es/types/Interface/api/product/CreateProduct.d.ts +10 -0
  54. package/es/types/Interface/api/product/CreateProduct.d.ts.map +1 -0
  55. package/es/types/Interface/api/product/CreateProduct.js +62 -0
  56. package/es/types/Interface/api/product/CreateProduct.js.map +1 -0
  57. package/es/types/Interface/api/product/QueryProduct.d.ts +5 -0
  58. package/es/types/Interface/api/product/QueryProduct.d.ts.map +1 -0
  59. package/es/types/Interface/api/product/QueryProduct.js +27 -0
  60. package/es/types/Interface/api/product/QueryProduct.js.map +1 -0
  61. package/es/types/Interface/api/product/UpdateProduct.d.ts +4 -0
  62. package/es/types/Interface/api/product/UpdateProduct.d.ts.map +1 -0
  63. package/es/types/Interface/api/product/UpdateProduct.js +4 -0
  64. package/es/types/Interface/api/product/UpdateProduct.js.map +1 -0
  65. package/es/types/Interface/api/society/CreateSociety.d.ts +5 -0
  66. package/es/types/Interface/api/society/CreateSociety.d.ts.map +1 -1
  67. package/es/types/Interface/api/society/CreateSociety.js +14 -0
  68. package/es/types/Interface/api/society/CreateSociety.js.map +1 -1
  69. package/es/types/Interface/api/society/UpdateSociety.d.ts +4 -0
  70. package/es/types/Interface/api/society/UpdateSociety.d.ts.map +1 -1
  71. package/es/types/Interface/api/society/UpdateSociety.js +6 -0
  72. package/es/types/Interface/api/society/UpdateSociety.js.map +1 -1
  73. package/es/types/Interface/models/IEstimateInvoice.d.ts +2 -4
  74. package/es/types/Interface/models/IEstimateInvoice.d.ts.map +1 -1
  75. package/es/types/Interface/models/IEstimateInvoice.js.map +1 -1
  76. package/es/types/Interface/models/IPartneredAccountantToSociety.d.ts +12 -0
  77. package/es/types/Interface/models/IPartneredAccountantToSociety.d.ts.map +1 -0
  78. package/es/types/Interface/models/IPartneredAccountantToSociety.js +2 -0
  79. package/es/types/Interface/models/IPartneredAccountantToSociety.js.map +1 -0
  80. package/es/types/Interface/models/IPermission.d.ts +1 -1
  81. package/es/types/Interface/models/IPermission.d.ts.map +1 -1
  82. package/es/types/Interface/models/IPermission.js.map +1 -1
  83. package/es/types/Interface/models/IProduct.d.ts +6 -13
  84. package/es/types/Interface/models/IProduct.d.ts.map +1 -1
  85. package/es/types/Interface/models/IProduct.js.map +1 -1
  86. package/es/types/Interface/models/IProductInvoice.d.ts +22 -0
  87. package/es/types/Interface/models/IProductInvoice.d.ts.map +1 -0
  88. package/es/types/Interface/models/IProductInvoice.js +2 -0
  89. package/es/types/Interface/models/IProductInvoice.js.map +1 -0
  90. package/es/types/index.d.ts +13 -3
  91. package/es/types/index.d.ts.map +1 -1
  92. package/es/types/index.js +13 -3
  93. package/es/types/index.js.map +1 -1
  94. package/es/utils/validators/objectId.validator.d.ts +11 -0
  95. package/es/utils/validators/objectId.validator.d.ts.map +1 -0
  96. package/es/utils/validators/objectId.validator.js +19 -0
  97. package/es/utils/validators/objectId.validator.js.map +1 -0
  98. package/js/api/resources/FecFile.js +3 -3
  99. package/js/api/resources/FecFile.js.map +1 -1
  100. package/js/api/resources/PartneredAccountant.js +12 -0
  101. package/js/api/resources/PartneredAccountant.js.map +1 -1
  102. package/js/api/resources/Product.js +36 -0
  103. package/js/api/resources/Product.js.map +1 -0
  104. package/js/api/resources/Society.js +14 -0
  105. package/js/api/resources/Society.js.map +1 -1
  106. package/js/types/Enum/ProductType.js +13 -0
  107. package/js/types/Enum/ProductType.js.map +1 -0
  108. package/js/types/Enum/RegistrationSource.js +12 -0
  109. package/js/types/Enum/RegistrationSource.js.map +1 -0
  110. package/js/types/Enum/Unit.js +103 -0
  111. package/js/types/Enum/Unit.js.map +1 -0
  112. package/js/types/Interface/api/BasePaginate.js +25 -0
  113. package/js/types/Interface/api/BasePaginate.js.map +1 -1
  114. package/js/types/Interface/api/fecFile/QueryFecFile.js +27 -0
  115. package/js/types/Interface/api/fecFile/QueryFecFile.js.map +1 -0
  116. package/js/types/Interface/api/partneredAccountant/CreatePartneredAccountantSociety.js +94 -0
  117. package/js/types/Interface/api/partneredAccountant/CreatePartneredAccountantSociety.js.map +1 -0
  118. package/js/types/Interface/api/partneredAccountant/CreatedPartneredAccountantSociety.js +10 -0
  119. package/js/types/Interface/api/partneredAccountant/CreatedPartneredAccountantSociety.js.map +1 -0
  120. package/js/types/Interface/api/partneredAccountant/QueryPartneredAccountantSocieties.js +33 -0
  121. package/js/types/Interface/api/partneredAccountant/QueryPartneredAccountantSocieties.js.map +1 -0
  122. package/js/types/Interface/{models/IUnit.js → api/partneredAccountant/ReadPartneredAccountantSociety.js} +1 -1
  123. package/js/types/Interface/{models/IUnit.js.map → api/partneredAccountant/ReadPartneredAccountantSociety.js.map} +1 -1
  124. package/js/types/Interface/api/product/CreateProduct.js +51 -0
  125. package/js/types/Interface/api/product/CreateProduct.js.map +1 -0
  126. package/js/types/Interface/api/product/QueryProduct.js +33 -0
  127. package/js/types/Interface/api/product/QueryProduct.js.map +1 -0
  128. package/js/types/Interface/api/product/UpdateProduct.js +13 -0
  129. package/js/types/Interface/api/product/UpdateProduct.js.map +1 -0
  130. package/js/types/Interface/api/society/CreateSociety.js +16 -0
  131. package/js/types/Interface/api/society/CreateSociety.js.map +1 -1
  132. package/js/types/Interface/api/society/UpdateSociety.js +7 -1
  133. package/js/types/Interface/api/society/UpdateSociety.js.map +1 -1
  134. package/js/types/Interface/models/{IProductType.js → IPartneredAccountantToSociety.js} +1 -1
  135. package/js/types/Interface/models/{IProductType.js.map → IPartneredAccountantToSociety.js.map} +1 -1
  136. package/js/types/Interface/models/{IItemEstimate.js → IProductInvoice.js} +1 -1
  137. package/js/types/Interface/models/{IItemEstimate.js.map → IProductInvoice.js.map} +1 -1
  138. package/js/types/index.js +147 -27
  139. package/js/types/index.js.map +1 -1
  140. package/js/utils/validators/objectId.validator.js +29 -0
  141. package/js/utils/validators/objectId.validator.js.map +1 -0
  142. package/package.json +1 -1
  143. package/ts/api/resources/FecFile.ts +6 -2
  144. package/ts/api/resources/PartneredAccountant.ts +16 -0
  145. package/ts/api/resources/Product.ts +31 -0
  146. package/ts/api/resources/Society.ts +11 -0
  147. package/ts/types/Enum/ProductType.ts +5 -0
  148. package/ts/types/Enum/RegistrationSource.ts +4 -0
  149. package/ts/types/Enum/Unit.ts +105 -0
  150. package/ts/types/Interface/api/BasePaginate.ts +17 -0
  151. package/ts/types/Interface/api/fecFile/QueryFecFile.ts +6 -0
  152. package/ts/types/Interface/api/partneredAccountant/CreatePartneredAccountantSociety.ts +68 -0
  153. package/ts/types/Interface/api/partneredAccountant/CreatedPartneredAccountantSociety.ts +6 -0
  154. package/ts/types/Interface/api/partneredAccountant/QueryPartneredAccountantSocieties.ts +11 -0
  155. package/ts/types/Interface/api/partneredAccountant/ReadPartneredAccountantSociety.ts +4 -0
  156. package/ts/types/Interface/api/product/CreateProduct.ts +48 -0
  157. package/ts/types/Interface/api/product/QueryProduct.ts +15 -0
  158. package/ts/types/Interface/api/product/UpdateProduct.ts +3 -0
  159. package/ts/types/Interface/api/society/CreateSociety.ts +11 -0
  160. package/ts/types/Interface/api/society/UpdateSociety.ts +6 -0
  161. package/ts/types/Interface/models/IEstimateInvoice.ts +2 -4
  162. package/ts/types/Interface/models/IPartneredAccountantToSociety.ts +15 -0
  163. package/ts/types/Interface/models/IPermission.ts +1 -1
  164. package/ts/types/Interface/models/IProduct.ts +6 -13
  165. package/ts/types/Interface/models/{IItemEstimate.ts → IProductInvoice.ts} +8 -12
  166. package/ts/types/index.ts +14 -4
  167. package/ts/utils/validators/objectId.validator.ts +31 -0
  168. package/es/types/Interface/models/IItemEstimate.d.ts +0 -26
  169. package/es/types/Interface/models/IItemEstimate.d.ts.map +0 -1
  170. package/es/types/Interface/models/IItemEstimate.js +0 -2
  171. package/es/types/Interface/models/IItemEstimate.js.map +0 -1
  172. package/es/types/Interface/models/IProductType.d.ts +0 -7
  173. package/es/types/Interface/models/IProductType.d.ts.map +0 -1
  174. package/es/types/Interface/models/IProductType.js +0 -2
  175. package/es/types/Interface/models/IProductType.js.map +0 -1
  176. package/es/types/Interface/models/IUnit.d.ts +0 -8
  177. package/es/types/Interface/models/IUnit.d.ts.map +0 -1
  178. package/es/types/Interface/models/IUnit.js +0 -2
  179. package/es/types/Interface/models/IUnit.js.map +0 -1
  180. package/ts/types/Interface/models/IProductType.ts +0 -7
  181. package/ts/types/Interface/models/IUnit.ts +0 -8
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.IsObjectId = IsObjectId;
7
+
8
+ var _classValidator = require("class-validator");
9
+
10
+ function IsObjectId(property, validationOptions) {
11
+ return function validator(object, propertyName) {
12
+ (0, _classValidator.registerDecorator)({
13
+ name: 'IsObjectId',
14
+ target: object.constructor,
15
+ propertyName,
16
+ constraints: [property],
17
+ options: Object.assign({
18
+ message: `${propertyName} should be a valid id from enum`
19
+ }, validationOptions),
20
+ validator: {
21
+ validate(value, args) {
22
+ return typeof value === 'number' && Object.values(property).map(p => p.id).includes(value);
23
+ }
24
+
25
+ }
26
+ });
27
+ };
28
+ }
29
+ //# sourceMappingURL=objectId.validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../ts/utils/validators/objectId.validator.ts"],"names":[],"mappings":";;;;;QAWgB,U,GAAA,U;;AAXhB;;AAWM,SAAU,UAAV,CAAqB,QAArB,EAA2C,iBAA3C,EAAgF;AACpF,SAAO,SAAS,SAAT,CAAmB,MAAnB,EAAgC,YAAhC,EAAoD;AACzD,2CAAkB;AAChB,MAAA,IAAI,EAAE,YADU;AAEhB,MAAA,MAAM,EAAE,MAAM,CAAC,WAFC;AAGhB,MAAA,YAHgB;AAIhB,MAAA,WAAW,EAAE,CAAC,QAAD,CAJG;AAKhB,MAAA,OAAO,EAAA,MAAA,CAAA,MAAA,CAAA;AACL,QAAA,OAAO,EAAE,GAAG,YAAY;AADnB,OAAA,EAEF,iBAFE,CALS;AAShB,MAAA,SAAS,EAAE;AACT,QAAA,QAAQ,CAAC,KAAD,EAAa,IAAb,EAAsC;AAC5C,iBAAO,OAAO,KAAP,KAAiB,QAAjB,IACJ,MAAM,CAAC,MAAP,CAAc,QAAd,EAAwB,GAAxB,CAA6B,CAAD,IAAO,CAAC,CAAC,EAArC,EAAyC,QAAzC,CAAkD,KAAlD,CADH;AAED;;AAJQ;AATK,KAAlB;AAgBD,GAjBD;AAkBD","sourcesContent":["import { registerDecorator, ValidationArguments, ValidationOptions } from 'class-validator';\n\ninterface ObjectWithId {\n id: number;\n [key: string]: unknown;\n}\n\ninterface EnumObject {\n [key: string]: ObjectWithId\n}\n\nexport function IsObjectId(property: EnumObject, validationOptions?: ValidationOptions) {\n return function validator(object: any, propertyName: string) {\n registerDecorator({\n name: 'IsObjectId',\n target: object.constructor,\n propertyName,\n constraints: [property],\n options: {\n message: `${propertyName} should be a valid id from enum`,\n ...validationOptions,\n },\n validator: {\n validate(value: any, args: ValidationArguments) {\n return typeof value === 'number'\n && Object.values(property).map((p) => p.id).includes(value);\n },\n },\n });\n };\n}"],"sourceRoot":"","file":"objectId.validator.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "0.4.102",
3
+ "version": "0.4.103",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "js/index.js",
@@ -5,6 +5,7 @@ import {
5
5
  ReadFecFile,
6
6
  IFecFile,
7
7
  CreateMappingFecFile,
8
+ QueryFecFile,
8
9
  } from '../../types';
9
10
 
10
11
  export class FecFile extends Resource {
@@ -16,8 +17,11 @@ export class FecFile extends Resource {
16
17
  return this.axios.$get('fecFile/download', { responseType: 'blob' });
17
18
  }
18
19
 
19
- export(idExercice: number): Promise<any> {
20
- return this.axios.$get(`fecFile/exercice/${idExercice}/export`, { responseType: 'blob' });
20
+ export(idExercice: number, payload?: QueryFecFile): Promise<any> {
21
+ return this.axios.$get(`fecFile/exercice/${idExercice}/export`, {
22
+ ...payload,
23
+ responseType: 'blob',
24
+ });
21
25
  }
22
26
 
23
27
  create(params: CreateFecFile): Promise<ReadFecFile> {
@@ -13,8 +13,13 @@ import {
13
13
  UpdatedPartneredAccountantAccess, UpdatedPartneredAccountantSoldService,
14
14
  UpdatePartneredAccountantAccess,
15
15
  UpdatePartneredAccountantSoldService,
16
+ CreatePartneredAccountantSociety,
17
+ BasePaginate,
18
+ QueryPartneredAccountantSocieties,
19
+ CreatedPartneredAccountantSociety,
16
20
  } from '../../types';
17
21
  import { Resource } from '../Resource';
22
+ import { ReadPartneredAccountantSociety } from '../../types/Interface/api/partneredAccountant/ReadPartneredAccountantSociety';
18
23
 
19
24
  export class PartneredAccountant extends Resource {
20
25
  getAll(): Promise<Array<ReadPartneredAccountant>> {
@@ -63,4 +68,15 @@ export class PartneredAccountant extends Resource {
63
68
  createRequestedServices(idPartneredAccountant: number, payload: Array<CreatePartneredAccountantRequestedService>): Promise<Array<IPartneredAccountantCompanyService>> {
64
69
  return this.axios.$post(`/partnered-accountants/${idPartneredAccountant}/requested-services`, payload);
65
70
  }
71
+
72
+ getPaginatedSocieties(params: QueryPaginate & QueryPartneredAccountantSocieties, cancelToken?: CancelToken): Promise<BasePaginate<ReadPartneredAccountantSociety>> {
73
+ return this.axios.$get('/partnered-accountants/societies', {
74
+ ...(cancelToken ? { cancelToken } : {}),
75
+ params,
76
+ });
77
+ }
78
+
79
+ createSociety(params: CreatePartneredAccountantSociety): Promise<CreatedPartneredAccountantSociety> {
80
+ return this.axios.$post('/partnered-accountants/societies', params);
81
+ }
66
82
  }
@@ -0,0 +1,31 @@
1
+ import { Resource } from '../Resource';
2
+ import {
3
+ IProduct, QueryPaginate, QueryProduct, BasePaginate, CreateProduct, UpdateProduct,
4
+ } from '../../types';
5
+
6
+ export class Product extends Resource {
7
+ getAll(): Promise<Array<IProduct>> {
8
+ return this.axios.$get('/commercial-management/products');
9
+ }
10
+
11
+ getPaginated(pagination: QueryPaginate, query?: QueryProduct): Promise<BasePaginate<IProduct>> {
12
+ return this.axios.$get('/commercial-management/products', {
13
+ params: {
14
+ ...pagination,
15
+ ...query,
16
+ },
17
+ });
18
+ }
19
+
20
+ create(payload: CreateProduct): Promise<IProduct> {
21
+ return this.axios.$post('/commercial-management/products', payload);
22
+ }
23
+
24
+ update(id: number, payload: UpdateProduct): Promise<IProduct> {
25
+ return this.axios.$put(`/commercial-management/products/${id}`, payload);
26
+ }
27
+
28
+ delete(id: number): Promise<boolean> {
29
+ return this.axios.$delete(`/commercial-management/products/${id}`);
30
+ }
31
+ }
@@ -16,6 +16,7 @@ import {
16
16
  UpdateUserToSocietyWithPermission,
17
17
  ReadSocietyUsers,
18
18
  QuerySociety,
19
+ UpdateSocietyPayload,
19
20
  } from '../../types';
20
21
 
21
22
  export class Society extends Resource {
@@ -40,6 +41,16 @@ export class Society extends Resource {
40
41
  updateSociety(id: number, data: UpdateSociety): Promise<ISociety> {
41
42
  return this.axios.$put(`/society/${id}/updateSociety`, data);
42
43
  }
44
+
45
+ update(id: number, payload: UpdateSocietyPayload): Promise<ISociety> {
46
+ return this.axios.patch(`/society/${id}`, payload);
47
+ }
48
+
49
+ archive(id: number): Promise<ISociety> {
50
+ const payload: UpdateSocietyPayload = { society: { archive: true, archiveDate: new Date() } };
51
+ return this.axios.patch(`/society/${id}`, payload);
52
+ }
53
+
43
54
  // this endpoint is used to fetch from extern api for legalForm
44
55
  getDataSociety(params: GetDataSociety): Promise<LegalFormSiren[]> {
45
56
  return this.axios.$get('/society/dataSociety', { params });
@@ -0,0 +1,5 @@
1
+ export enum ProductType {
2
+ PRODUCT = 1,
3
+ SERVICE = 2,
4
+ GOODS = 3,
5
+ }
@@ -0,0 +1,4 @@
1
+ export enum RegistrationSource {
2
+ ONLINE_SUBSCRIPTION = 70,
3
+ PARTNERED_ACCOUNTANT = 90,
4
+ }
@@ -0,0 +1,105 @@
1
+ export interface IUnit {
2
+ [key: string]: {
3
+ id: number,
4
+ name: string,
5
+ shortName: string,
6
+ }
7
+ }
8
+
9
+ export const Unit: IUnit = {
10
+ ITEM: {
11
+ id: 1,
12
+ name: 'Article',
13
+ shortName: 'Art',
14
+ },
15
+ HOUR: {
16
+ id: 2,
17
+ name: 'Heure',
18
+ shortName: 'h',
19
+ },
20
+ DAY: {
21
+ id: 3,
22
+ name: 'Jour',
23
+ shortName: 'j',
24
+ },
25
+ KILOGRAM: {
26
+ id: 4,
27
+ name: 'Kilogramme',
28
+ shortName: 'kg',
29
+ },
30
+ LITER: {
31
+ id: 5,
32
+ name: 'Litre',
33
+ shortName: 'l',
34
+ },
35
+ KILOMETER: {
36
+ id: 6,
37
+ name: 'Kilomètres',
38
+ shortName: 'km',
39
+ },
40
+ HALF_DAY: {
41
+ id: 7,
42
+ name: 'Demi journée',
43
+ shortName: 'demi j',
44
+ },
45
+ YEAR: {
46
+ id: 8,
47
+ name: 'Année',
48
+ shortName: 'an',
49
+ },
50
+ WEEK: {
51
+ id: 9,
52
+ name: 'Semaine',
53
+ shortName: 'sem',
54
+ },
55
+ MONTH: {
56
+ id: 10,
57
+ name: 'Mois',
58
+ shortName: 'mois',
59
+ },
60
+ QUARTER: {
61
+ id: 11,
62
+ name: 'Trimestre',
63
+ shortName: 'trst,',
64
+ },
65
+ PIECE: {
66
+ id: 12,
67
+ name: 'Pièce',
68
+ shortName: 'p',
69
+ },
70
+ FIXED: {
71
+ id: 13,
72
+ name: 'Forfaitaire',
73
+ shortName: 'f',
74
+ },
75
+ SQUARE_METER: {
76
+ id: 14,
77
+ name: 'Mètre carré',
78
+ shortName: 'm2',
79
+ },
80
+ CUBIC_METER: {
81
+ id: 15,
82
+ name: 'Mètre cube',
83
+ shortName: 'm3',
84
+ },
85
+ METER: {
86
+ id: 16,
87
+ name: 'Mètre',
88
+ shortName: 'm',
89
+ },
90
+ SUBSCROPTION: {
91
+ id: 17,
92
+ name: 'Abonnement',
93
+ shortName: 'abo',
94
+ },
95
+ NIGHT: {
96
+ id: 18,
97
+ name: 'Nuitée',
98
+ shortName: 'nuit',
99
+ },
100
+ TON: {
101
+ id: 19,
102
+ name: 'Tonne',
103
+ shortName: 't',
104
+ },
105
+ };
@@ -1,3 +1,6 @@
1
+ import { IsInt, IsOptional, Min } from 'class-validator';
2
+ import { ApiPropertyOptional } from '../../..';
3
+
1
4
  export interface BasePaginate<T> {
2
5
  maxPages: number;
3
6
  currentPage: number;
@@ -9,3 +12,17 @@ export interface QueryPaginate {
9
12
  page: number,
10
13
  limit: number,
11
14
  }
15
+
16
+ export class OptionalQueryPaginate implements QueryPaginate {
17
+ @ApiPropertyOptional()
18
+ @IsInt()
19
+ @Min(1)
20
+ @IsOptional()
21
+ page: number;
22
+
23
+ @ApiPropertyOptional()
24
+ @IsInt()
25
+ @Min(1)
26
+ @IsOptional()
27
+ limit: number;
28
+ }
@@ -0,0 +1,6 @@
1
+ import { ApiPropertyOptional } from '../../../../utils';
2
+
3
+ export class QueryFecFile {
4
+ @ApiPropertyOptional()
5
+ idSociety?: number;
6
+ }
@@ -0,0 +1,68 @@
1
+ import {
2
+ ApiProperty, VatRegime, FiscalRegime, ComptaType, ApiPropertyOptional, Country, Activity,
3
+ } from '../../../..';
4
+ import { AccountsSectorsEnum } from '../../../Enum/AccountsSectors';
5
+ import { TaxSystem } from '../../../Enum/TaxSystem';
6
+ import { ProfitsType } from '../../../Enum/ProfitsType';
7
+
8
+ export class CreatePartneredAccountantSociety {
9
+ @ApiProperty()
10
+ firstname: string;
11
+
12
+ @ApiProperty()
13
+ lastname: string;
14
+
15
+ @ApiProperty()
16
+ email: string;
17
+
18
+ @ApiProperty()
19
+ phoneNumber: string;
20
+
21
+ @ApiProperty({ description: 'Nom de la société' })
22
+ name: string;
23
+
24
+ @ApiProperty()
25
+ idLegalForm: number;
26
+
27
+ @ApiProperty({ enum: AccountsSectorsEnum, default: AccountsSectorsEnum.DEFAULT.id })
28
+ idSector: number;
29
+
30
+ @ApiProperty({ enum: VatRegime })
31
+ idVatRegime: VatRegime;
32
+
33
+ @ApiProperty({ enum: FiscalRegime })
34
+ idFiscalRegime: FiscalRegime;
35
+
36
+ @ApiProperty({ enum: Activity })
37
+ idActivity: Activity;
38
+
39
+ @ApiProperty({ enum: TaxSystem })
40
+ idTaxSystem: TaxSystem;
41
+
42
+ @ApiProperty({ enum: ProfitsType })
43
+ idProfitsType: ProfitsType;
44
+
45
+ @ApiProperty({ description: 'Date de début de l\'exercice (format YYYY-MM-DD)' })
46
+ startDate: string;
47
+
48
+ @ApiProperty({ description: 'Date de fin de l\'exercice (format YYYY-MM-DD)' })
49
+ endDate: string;
50
+
51
+ @ApiProperty({ enum: ComptaType })
52
+ idComptaType: ComptaType;
53
+
54
+ @ApiPropertyOptional()
55
+ siret?: string | null;
56
+
57
+ @ApiPropertyOptional()
58
+ address?: string | null;
59
+
60
+ @ApiPropertyOptional()
61
+ city?: string | null;
62
+
63
+ @ApiPropertyOptional()
64
+ zipCode?: string | null;
65
+
66
+ @ApiPropertyOptional({ enum: Country })
67
+ idCountry?: Country | null;
68
+ }
@@ -0,0 +1,6 @@
1
+ import { IUser, ISociety } from '../../..';
2
+
3
+ export class CreatedPartneredAccountantSociety {
4
+ society: ISociety;
5
+ user: IUser;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { IsBoolean, IsOptional } from 'class-validator';
2
+ import { ApiPropertyOptional } from '../../../../utils';
3
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
4
+
5
+ export class QueryPartneredAccountantSocieties {
6
+ @ApiPropertyOptional({ description: 'Retourne uniquement les utilisateurs actifs / inactifs' })
7
+ @IsBoolean()
8
+ @ToBoolean()
9
+ @IsOptional()
10
+ isActive?: boolean;
11
+ }
@@ -0,0 +1,4 @@
1
+ import { ISociety } from '../../models/ISociety';
2
+ import { IUser } from '../../models/IUser';
3
+
4
+ export type ReadPartneredAccountantSociety = ISociety & { userToContact: IUser };
@@ -0,0 +1,48 @@
1
+ import {
2
+ IsEnum,
3
+ IsNumber, IsOptional, IsString, Min,
4
+ } from 'class-validator';
5
+ import { ProductType, Unit, Vat } from '../../..';
6
+ import { ApiProperty, ApiPropertyOptional } from '../../../..';
7
+ import { IsObjectId } from '../../../../utils/validators/objectId.validator';
8
+
9
+ export class CreateProduct {
10
+ @ApiProperty()
11
+ @IsString()
12
+ name: string;
13
+
14
+ @ApiProperty()
15
+ @IsNumber({
16
+ maxDecimalPlaces: 6,
17
+ }, {
18
+ message: 'Price should be a number with maximum 6 decimal',
19
+ })
20
+ @Min(0, {
21
+ message: 'Price should be positive',
22
+ })
23
+ priceTaxExcluded: number;
24
+
25
+ @ApiProperty()
26
+ @IsNumber()
27
+ @IsObjectId(Vat)
28
+ idVAT: number;
29
+
30
+ @ApiProperty()
31
+ @IsNumber()
32
+ @IsObjectId(Unit)
33
+ unit: number;
34
+
35
+ @ApiProperty()
36
+ @IsEnum(ProductType)
37
+ type: number;
38
+
39
+ @ApiPropertyOptional()
40
+ @IsString()
41
+ @IsOptional()
42
+ comment?: string;
43
+
44
+ @ApiPropertyOptional()
45
+ @IsString()
46
+ @IsOptional()
47
+ codeProduct?: string;
48
+ }
@@ -0,0 +1,15 @@
1
+ import { IsEnum, IsOptional, IsString } from 'class-validator';
2
+ import { ProductType } from '../../..';
3
+ import { ApiPropertyOptional } from '../../../..';
4
+
5
+ export class QueryProduct {
6
+ @ApiPropertyOptional()
7
+ @IsOptional()
8
+ @IsString()
9
+ search?: string;
10
+
11
+ @ApiPropertyOptional()
12
+ @IsOptional()
13
+ @IsEnum(ProductType)
14
+ type?: number;
15
+ }
@@ -0,0 +1,3 @@
1
+ import { CreateProduct } from './CreateProduct';
2
+
3
+ export class UpdateProduct extends CreateProduct {}
@@ -1,4 +1,6 @@
1
1
  import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
2
+ import { SubscriptionType } from '../../../Enum/SubscriptionType';
3
+ import { RegistrationSource } from '../../../Enum/RegistrationSource';
2
4
 
3
5
  export type AnalticsUtm = {
4
6
  utm_source?: string;
@@ -43,6 +45,9 @@ export class CreateSociety {
43
45
  @ApiPropertyOptional()
44
46
  zipCode?: string;
45
47
 
48
+ @ApiPropertyOptional({ enum: RegistrationSource })
49
+ idSource?: RegistrationSource;
50
+
46
51
  @ApiPropertyOptional()
47
52
  analyticsUtm?: AnalticsUtm;
48
53
 
@@ -60,4 +65,10 @@ export class CreateSociety {
60
65
 
61
66
  @ApiPropertyOptional()
62
67
  idSector?: number;
68
+
69
+ @ApiPropertyOptional({ enum: SubscriptionType })
70
+ idSubscriptionType?: SubscriptionType;
71
+
72
+ @ApiPropertyOptional({ description: 'Identifiant de l\'Expert-Comptable partenaire' })
73
+ idPartneredAccountant?: number | null;
63
74
  }
@@ -1,4 +1,5 @@
1
1
  import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
2
+ import { ISociety } from '../../models/ISociety';
2
3
 
3
4
  export class UpdateSociety {
4
5
  @ApiProperty()
@@ -42,4 +43,9 @@ export class UpdateSociety {
42
43
 
43
44
  @ApiPropertyOptional()
44
45
  confirmedAt?: string;
46
+ }
47
+
48
+ export class UpdateSocietyPayload {
49
+ @ApiPropertyOptional()
50
+ society: Partial<ISociety>;
45
51
  }
@@ -1,5 +1,4 @@
1
- import { IProduct } from './IProduct';
2
- import { IItemEstimate } from './IItemEstimate';
1
+ import { IProductInvoice } from './IProductInvoice';
3
2
  import { IEstimateInvoiceRepeat } from './IEstimateInvoiceRepeat';
4
3
  import { IPaymentExpectationCustomer } from './IPaymentExpectationCustomer';
5
4
  import { IThirdParty } from './IThirdParty';
@@ -56,8 +55,7 @@ export interface IEstimateInvoice {
56
55
  deletedAt?: Date | null;
57
56
 
58
57
  // Associations
59
- estimatesInvoicesProducts?: IProduct[];
60
- productItemsEstimates?: IItemEstimate[];
58
+ invoiceProducts?: IProductInvoice[];
61
59
  estimateInvoiceEstimateInvoiceRepeat?: IEstimateInvoiceRepeat;
62
60
  estimateInvoicePaymentExpectationCustomer?: IPaymentExpectationCustomer;
63
61
  estimatesInvoicesThirdParty?: IThirdParty;
@@ -0,0 +1,15 @@
1
+ import { ISociety } from './ISociety';
2
+ import { IPartneredAccountant } from './IPartneredAccountant';
3
+
4
+ export interface IPartneredAccountantToSociety {
5
+ id?: number;
6
+ idPartneredAccountant: number;
7
+ idSociety: number;
8
+
9
+ createdAt?: number;
10
+ updatedAt?: number;
11
+
12
+ // Associations
13
+ partneredAccountant?: IPartneredAccountant;
14
+ society?: ISociety;
15
+ }
@@ -19,5 +19,5 @@ export interface IPermission {
19
19
  updatedAt?: Date | null;
20
20
 
21
21
  // Associations
22
- usersSocietiesPermission: IUserSocietyPermission;
22
+ usersSocietiesPermission?: IUserSocietyPermission;
23
23
  }
@@ -1,29 +1,22 @@
1
- import { IEstimateInvoice } from './IEstimateInvoice';
2
1
  import { IVat } from './IVat';
3
- import { IUnit } from './IUnit';
4
- import { IProductType } from './IProductType';
5
2
  import { ISociety } from './ISociety';
6
3
 
7
4
  // products
8
5
  export interface IProduct {
9
6
  id?: number;
10
7
  name: string;
11
- isFree: boolean;
12
8
  comment: string | null;
13
9
  codeProduct: string | null;
14
- price: number;
15
- idTva: number;
16
- idUnity: number | null;
17
- idTypeProduct: number | null;
10
+ priceTaxExcluded: number;
11
+ idVAT: number;
12
+ unit: number | null;
13
+ type: number | null;
18
14
  idSociety: number;
19
15
  createdAt?: Date | null;
20
16
  updatedAt?: Date | null;
21
17
  deletedAt?: Date | null;
22
18
 
23
19
  // Associations
24
- estimatesInvoices?: IEstimateInvoice[];
25
- productTva?: IVat;
26
- productUnity?: IUnit;
27
- productTypeProduct?: IProductType;
28
- productSociety?: ISociety;
20
+ vat?: IVat;
21
+ society?: ISociety;
29
22
  }
@@ -1,19 +1,17 @@
1
1
  import { IVat } from './IVat';
2
2
  import { IProduct } from './IProduct';
3
- import { IUnit } from './IUnit';
4
- import { IProductType } from './IProductType';
5
3
 
6
4
  // itemsEstimates
7
- export interface IItemEstimate {
5
+ export interface IProductInvoice {
8
6
  id?: number;
9
7
  idEstimateInvoice: number;
10
- idProduct: number;
11
- idTva: number;
12
- idUnity: number;
13
- idTypeProduct: number;
8
+ idProduct: number | null;
9
+ idVAT: number;
10
+ unit: number;
11
+ type: number;
14
12
  itemSaleName: string | null;
15
13
  itemCodeProduct: string | null;
16
- itemSalePrice: number;
14
+ priceTaxExcluded: number;
17
15
  quantity: number;
18
16
  discount: number | null;
19
17
  comment: string | null;
@@ -22,8 +20,6 @@ export interface IItemEstimate {
22
20
  updatedAt?: Date | null;
23
21
 
24
22
  // Associations
25
- itemsEstimatesTva?: IVat;
26
- itemsEstimatesProduct?: IProduct;
27
- itemsEstimatesUnity?: IUnit;
28
- itemsEstimatesTypeProduct?: IProductType;
23
+ vat?: IVat;
24
+ product: IProduct;
29
25
  }