@nomalism-com/api 0.34.31 → 0.35.0

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/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "typescript",
10
10
  "helper"
11
11
  ],
12
- "version": "0.34.31",
12
+ "version": "0.35.0",
13
13
  "type": "module",
14
14
  "main": "./dist/index.cjs",
15
15
  "module": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "prepack": "npm run lint && npm run build"
40
40
  },
41
41
  "dependencies": {
42
- "@nomalism-com/types": "^0.34.33",
42
+ "@nomalism-com/types": "^0.35.0",
43
43
  "axios": "^1.9.0"
44
44
  },
45
45
  "devDependencies": {
package/src/main.ts CHANGED
@@ -114,6 +114,7 @@ import AdminPanelClass from './modules/view/adminPanel';
114
114
  import DocumentLineRmClass from './modules/supply/documentLineRm';
115
115
  import DocumentLineMtClass from './modules/supply/documentLineMt';
116
116
  import ChatSubscriberClass from './modules/user/chatSubscriber';
117
+ import TagClass from './modules/stock/tag';
117
118
 
118
119
  export * as BankData from './modules/user/bankData';
119
120
  export * as Client from './modules/user/clients';
@@ -221,6 +222,7 @@ export * as AdminPanelClass from './modules/view/adminPanel';
221
222
  export * as DocumentLineRmClass from './modules/supply/documentLineRm';
222
223
  export * as DocumentLineMtClass from './modules/supply/documentLineMt';
223
224
  export * as ChatSubscriberClass from './modules/user/chatSubscriber';
225
+ export * as TagClass from './modules/stock/tag';
224
226
 
225
227
  export type IEnvironment = 'production' | 'uat' | 'development' | 'localhost';
226
228
 
@@ -475,6 +477,8 @@ export class API {
475
477
 
476
478
  public ChatSubscriber: ChatSubscriberClass;
477
479
 
480
+ public Tag: TagClass;
481
+
478
482
  constructor({ processEnvironment, services, gatewayUrl, apikey, tokenBearer }: IOptions) {
479
483
  this.processEnvironment = processEnvironment || 'localhost';
480
484
 
@@ -787,5 +791,7 @@ export class API {
787
791
  this.DocumentLineMt = new DocumentLineMtClass(getModuleParams('stock', 'document_line_mt'));
788
792
 
789
793
  this.ChatSubscriber = new ChatSubscriberClass(getModuleParams('users', 'chat_subscriber'));
794
+
795
+ this.Tag = new TagClass(getModuleParams('stock', 'tag'));
790
796
  }
791
797
  }
@@ -0,0 +1,45 @@
1
+ import Nomalism from '@nomalism-com/types';
2
+ import { AxiosInstance } from 'axios';
3
+ import { IModuleConstructor } from '../../main';
4
+
5
+ export default class Repository implements Nomalism.Tag.IRepository {
6
+ public route: string;
7
+
8
+ public publicRoute: string;
9
+
10
+ private api: AxiosInstance;
11
+
12
+ constructor({ api, route, publicRoute }: IModuleConstructor) {
13
+ this.api = api;
14
+ this.route = route;
15
+ this.publicRoute = publicRoute;
16
+ }
17
+
18
+ async create(body: Nomalism.Tag.ICreateRequest): Promise<void> {
19
+ const response = await this.api.post(`${this.route}`, body);
20
+ return response.data;
21
+ }
22
+
23
+ async findByDocumentHeaderId(
24
+ selector: Nomalism.shared.IFindByIdRequest,
25
+ ): Promise<Nomalism.Tag.IFindResponse[]> {
26
+ const response = await this.api.get(`${this.route}document_header_id/${selector.id}`);
27
+ return response.data;
28
+ }
29
+
30
+ async findById(selector: Nomalism.shared.IFindByIdRequest): Promise<Nomalism.Tag.IFindResponse> {
31
+ const response = await this.api.get(`${this.route}${selector.id}`);
32
+ return response.data;
33
+ }
34
+
35
+ async update(
36
+ selector: Nomalism.shared.IFindByIdRequest,
37
+ body: Nomalism.Tag.IUpdateRequest,
38
+ ): Promise<void> {
39
+ await this.api.put(`${this.route}${selector.id}`, body);
40
+ }
41
+
42
+ async delete(selector: Nomalism.shared.IFindByIdRequest): Promise<void> {
43
+ await this.api.delete(`${this.route}${selector.id}`);
44
+ }
45
+ }