@viridial/shared 1.0.17 → 1.0.19

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.
@@ -0,0 +1,47 @@
1
+ import type { Document } from '../types/document.types';
2
+ export interface DocumentUploadParams {
3
+ file: File;
4
+ organizationId: number;
5
+ createdBy: number;
6
+ propertyId?: number;
7
+ resourceId?: number;
8
+ description?: string;
9
+ }
10
+ /**
11
+ * Service de gestion des documents
12
+ */
13
+ export declare const documentService: {
14
+ /**
15
+ * Uploader un document
16
+ */
17
+ upload(params: DocumentUploadParams): Promise<Document>;
18
+ /**
19
+ * Récupérer un document par ID
20
+ */
21
+ getById(id: number): Promise<Document>;
22
+ /**
23
+ * Télécharger un document
24
+ */
25
+ download(id: number): Promise<Blob>;
26
+ /**
27
+ * Récupérer les documents d'une propriété
28
+ */
29
+ getByPropertyId(propertyId: number): Promise<Document[]>;
30
+ /**
31
+ * Récupérer les documents d'une ressource
32
+ */
33
+ getByResourceId(resourceId: number): Promise<Document[]>;
34
+ /**
35
+ * Supprimer un document
36
+ */
37
+ delete(id: number): Promise<void>;
38
+ /**
39
+ * Obtenir l'URL de téléchargement d'un document
40
+ */
41
+ getDownloadUrl(id: number): string;
42
+ /**
43
+ * Obtenir l'URL d'affichage d'un document (pour les images)
44
+ */
45
+ getViewUrl(id: number): string;
46
+ };
47
+ //# sourceMappingURL=document.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.service.d.ts","sourceRoot":"","sources":["../../api/document.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGvD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;IAC1B;;OAEG;mBACkB,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC;IA4B7D;;OAEG;gBACe,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAK5C;;OAEG;iBACgB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzC;;OAEG;gCAC+B,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAU9D;;OAEG;gCAC+B,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAU9D;;OAEG;eACc,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC;;OAEG;uBACgB,MAAM,GAAG,MAAM;IAIlC;;OAEG;mBACY,MAAM,GAAG,MAAM;CAG/B,CAAA"}
@@ -0,0 +1,83 @@
1
+ import { httpClient } from './http.client';
2
+ import { API_ENDPOINTS } from '../constants/api.constants';
3
+ /**
4
+ * Service de gestion des documents
5
+ */
6
+ export const documentService = {
7
+ /**
8
+ * Uploader un document
9
+ */
10
+ async upload(params) {
11
+ const formData = new FormData();
12
+ formData.append('file', params.file);
13
+ formData.append('organizationId', params.organizationId.toString());
14
+ formData.append('createdBy', params.createdBy.toString());
15
+ if (params.propertyId) {
16
+ formData.append('propertyId', params.propertyId.toString());
17
+ }
18
+ if (params.resourceId) {
19
+ formData.append('resourceId', params.resourceId.toString());
20
+ }
21
+ if (params.description) {
22
+ formData.append('description', params.description);
23
+ }
24
+ const response = await httpClient.post(API_ENDPOINTS.DOCUMENTS.UPLOAD, formData, {
25
+ headers: {
26
+ 'Content-Type': 'multipart/form-data'
27
+ }
28
+ });
29
+ return response.data;
30
+ },
31
+ /**
32
+ * Récupérer un document par ID
33
+ */
34
+ async getById(id) {
35
+ const response = await httpClient.get(API_ENDPOINTS.DOCUMENTS.BY_ID(id));
36
+ return response.data;
37
+ },
38
+ /**
39
+ * Télécharger un document
40
+ */
41
+ async download(id) {
42
+ const response = await httpClient.get(API_ENDPOINTS.DOCUMENTS.DOWNLOAD(id), {
43
+ responseType: 'blob'
44
+ });
45
+ return response.data;
46
+ },
47
+ /**
48
+ * Récupérer les documents d'une propriété
49
+ */
50
+ async getByPropertyId(propertyId) {
51
+ const response = await httpClient.get(API_ENDPOINTS.DOCUMENTS.BASE, {
52
+ params: { propertyId }
53
+ });
54
+ return response.data || [];
55
+ },
56
+ /**
57
+ * Récupérer les documents d'une ressource
58
+ */
59
+ async getByResourceId(resourceId) {
60
+ const response = await httpClient.get(API_ENDPOINTS.DOCUMENTS.BASE, {
61
+ params: { resourceId }
62
+ });
63
+ return response.data || [];
64
+ },
65
+ /**
66
+ * Supprimer un document
67
+ */
68
+ async delete(id) {
69
+ await httpClient.delete(API_ENDPOINTS.DOCUMENTS.BY_ID(id));
70
+ },
71
+ /**
72
+ * Obtenir l'URL de téléchargement d'un document
73
+ */
74
+ getDownloadUrl(id) {
75
+ return API_ENDPOINTS.DOCUMENTS.DOWNLOAD(id);
76
+ },
77
+ /**
78
+ * Obtenir l'URL d'affichage d'un document (pour les images)
79
+ */
80
+ getViewUrl(id) {
81
+ return API_ENDPOINTS.DOCUMENTS.DOWNLOAD(id);
82
+ }
83
+ };
@@ -32,6 +32,12 @@ export declare const API_ENDPOINTS: {
32
32
  readonly STATS: "/api/identity/organizations/stats";
33
33
  readonly SEARCH: "/api/identity/organizations/search";
34
34
  };
35
+ readonly DOCUMENTS: {
36
+ readonly BASE: "/api/documents";
37
+ readonly BY_ID: (id: number) => string;
38
+ readonly UPLOAD: "/api/documents/upload";
39
+ readonly DOWNLOAD: (id: number) => string;
40
+ };
35
41
  };
36
42
  /**
37
43
  * Get API base URL from environment
@@ -1 +1 @@
1
- {"version":3,"file":"api.constants.d.ts","sourceRoot":"","sources":["../../constants/api.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;6BAcV,MAAM;;;;6BAKN,MAAM;;;;gCAIH,MAAM;;;;6BAKT,MAAM;sCACG,MAAM;;sCAEN,MAAM;;;;CAIrB,CAAA;AAEV;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,SAAS,CAAA"}
1
+ {"version":3,"file":"api.constants.d.ts","sourceRoot":"","sources":["../../constants/api.constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;6BAcV,MAAM;;;;6BAKN,MAAM;;;;gCAIH,MAAM;;;;6BAKT,MAAM;sCACG,MAAM;;sCAEN,MAAM;;;;;;6BAOf,MAAM;;gCAEH,MAAM;;CAEf,CAAA;AAEV;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,SAAS,CAAA"}
@@ -35,6 +35,13 @@ export const API_ENDPOINTS = {
35
35
  CHILDREN: (parentId) => `/api/identity/organizations/${parentId}/children`,
36
36
  STATS: '/api/identity/organizations/stats',
37
37
  SEARCH: '/api/identity/organizations/search'
38
+ },
39
+ // Documents
40
+ DOCUMENTS: {
41
+ BASE: '/api/documents',
42
+ BY_ID: (id) => `/api/documents/${id}`,
43
+ UPLOAD: '/api/documents/upload',
44
+ DOWNLOAD: (id) => `/api/documents/${id}/download`
38
45
  }
39
46
  };
40
47
  /**
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { authService } from './api/auth.service';
6
6
  export { propertyService } from './api/property.service';
7
7
  export { userService } from './api/user.service';
8
8
  export { organizationService } from './api/organization.service';
9
+ export { documentService } from './api/document.service';
9
10
  export type { Organization, OrganizationCreate, OrganizationUpdate, OrganizationSearchParams, Team, TeamCreate, TeamUpdate, OrganizationUser } from './api/organization.service';
10
11
  export { useAuthStore } from './stores/auth.store';
11
12
  export { useUserStore } from './stores/user.store';
@@ -15,6 +16,7 @@ export type * from './types/api.types';
15
16
  export type * from './types/auth.types';
16
17
  export type * from './types/property.types';
17
18
  export type * from './types/user.types';
19
+ export type * from './types/document.types';
18
20
  export { PropertyType, PropertyStatus } from './types/property.types';
19
21
  export { tokenUtils } from './utils/token.utils';
20
22
  export { API_ENDPOINTS, API_BASE_URL } from './constants/api.constants';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAG/C,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,oBAAoB,CAAA;AAGvC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGvE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAG/C,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,wBAAwB,CAAA;AAG3C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGvE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA"}
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export { authService } from './api/auth.service';
7
7
  export { propertyService } from './api/property.service';
8
8
  export { userService } from './api/user.service';
9
9
  export { organizationService } from './api/organization.service';
10
+ export { documentService } from './api/document.service';
10
11
  // Stores
11
12
  export { useAuthStore } from './stores/auth.store';
12
13
  export { useUserStore } from './stores/user.store';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Types pour les documents
3
+ */
4
+ export interface Document {
5
+ id: number;
6
+ name: string;
7
+ description?: string;
8
+ type: string;
9
+ mimeType: string;
10
+ fileSize: number;
11
+ filePath: string;
12
+ url?: string;
13
+ resourceId?: number;
14
+ propertyId?: number;
15
+ organizationId: number;
16
+ createdBy: number;
17
+ active: boolean;
18
+ metadata?: string;
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ }
22
+ export interface DocumentUploadParams {
23
+ file: File;
24
+ organizationId: number;
25
+ createdBy: number;
26
+ propertyId?: number;
27
+ resourceId?: number;
28
+ description?: string;
29
+ }
30
+ //# sourceMappingURL=document.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.types.d.ts","sourceRoot":"","sources":["../../types/document.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Types pour les documents
3
+ */
4
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viridial/shared",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "type": "module",
5
5
  "description": "Shared modules for Real Estate frontend applications - Vue 3, TypeScript, Pinia, Axios",
6
6
  "main": "./dist/index.js",