@nomalism-com/types 0.34.39 → 0.35.1

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.39",
12
+ "version": "0.35.1",
13
13
  "type": "module",
14
14
  "module": "./dist/index.js",
15
15
  "main": "./dist/index.cjs",
package/src/main.ts CHANGED
@@ -356,6 +356,9 @@ import * as DocumentLineMtRoutes from './modules/supply/documentLineMT/route.sch
356
356
  import * as ChatSubscriber from './modules/user/chatSubscribers/interfaces';
357
357
  import * as ChatSubscriberRoutes from './modules/user/chatSubscribers/route.schema';
358
358
 
359
+ import * as Tag from './modules/stock/tag/interface';
360
+ import * as TagRoutes from './modules/stock/tag/route.schema';
361
+
359
362
  export {
360
363
  shared,
361
364
  // Errors,
@@ -677,4 +680,8 @@ export {
677
680
  //chat_subscriber
678
681
  ChatSubscriber,
679
682
  ChatSubscriberRoutes,
683
+
684
+ //tag
685
+ Tag,
686
+ TagRoutes,
680
687
  };
@@ -12,7 +12,6 @@ export interface IFindByDocumentLineStateResponse {
12
12
  created_at: Date;
13
13
  created_by: string;
14
14
  who_handles: string | null;
15
- tags: string | null;
16
15
  upfront_total: number;
17
16
  unread: boolean;
18
17
  }
@@ -0,0 +1,34 @@
1
+ import * as IShared from '../../../shared/interface';
2
+
3
+ import { Tag } from '../../../shared/entities/stock';
4
+
5
+ export type Entity = Tag;
6
+ export const Route = 'tag';
7
+ export const UpperName = 'Tag';
8
+ export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
9
+
10
+ export const ITagTypeEnum: {
11
+ private: 'private';
12
+ public: 'public';
13
+ } = {
14
+ private: 'private',
15
+ public: 'public',
16
+ };
17
+
18
+ export type ITagType = (typeof ITagTypeEnum)[keyof typeof ITagTypeEnum];
19
+
20
+ export const ITagType = Object.keys(ITagTypeEnum);
21
+
22
+ export type ICreateRequest = Omit<Entity, 'id' | 'createdAt' | 'updatedAt'>;
23
+ export type IUpdateRequest = Pick<Entity, 'index' | 'type'>;
24
+ export type IFindResponse = Omit<Entity, 'createdAt' | 'updatedAt'>;
25
+
26
+ export interface IRepository {
27
+ create(data: ICreateRequest): Promise<void>;
28
+ findByDocumentHeaderId(selector: IShared.IFindByIdRequest): Promise<IFindResponse[]>;
29
+ findById(selector: IShared.IFindByIdRequest): Promise<IFindResponse>;
30
+ update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
31
+ delete(selector: IShared.IFindByIdRequest): Promise<void>;
32
+ }
33
+
34
+ export type IController = IShared.IEntityWithUserToken<IRepository>;
@@ -0,0 +1,20 @@
1
+ import joi from 'joi';
2
+ import { messages } from '../../../shared/messages';
3
+ import * as IShared from '../../../shared/interface';
4
+ import { ICreateRequest, IUpdateRequest } from './interface';
5
+
6
+ // create body validation
7
+ const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
8
+ document_header_id: joi.string().uuid().required(),
9
+ index: joi.number().allow(0).required(),
10
+ text: joi.string().required(),
11
+ type: joi.string().valid('private', 'public').required(),
12
+ };
13
+ export const createBody = joi.object().keys(createBodyKeys).messages(messages);
14
+
15
+ // update body validation
16
+ const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
17
+ index: joi.number().allow(0).optional(),
18
+ type: joi.string().valid('private', 'public').optional(),
19
+ };
20
+ export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
@@ -217,7 +217,6 @@ export interface IUpdateRequest {
217
217
  is_archived?: boolean;
218
218
  is_void?: boolean;
219
219
  who_handles?: string | null;
220
- tags?: string | null;
221
220
  warning?: IWarningType;
222
221
  created_by?: string;
223
222
  }
@@ -267,7 +266,6 @@ export interface IFindResponse {
267
266
  total: number;
268
267
  emission_date: string;
269
268
  line_count: number;
270
- tags: string;
271
269
  is_void: boolean;
272
270
  is_archived: boolean;
273
271
  adjudicado: boolean;
@@ -370,7 +368,6 @@ export interface IFindRmOpenDocuments {
370
368
  document_header_id: string;
371
369
  document_number: string;
372
370
  identifier: string;
373
- tags: string | null;
374
371
  upfront_total: number | null;
375
372
  who_handles: string | null;
376
373
  document_lines: {
@@ -244,7 +244,6 @@ const updateBodyKeys: IShared.IRouteRequestWithStamps<IUpdateRequest> = {
244
244
  is_archived: joi.boolean().optional(),
245
245
  is_void: joi.boolean().optional(),
246
246
  who_handles: joi.string().allow(null).optional(),
247
- tags: joi.string().allow(null, '').optional(),
248
247
  warning: joi
249
248
  .string()
250
249
  .optional()
@@ -73,7 +73,6 @@ export interface IPublicFindByOwnerIdResponse {
73
73
  emission_date: Date;
74
74
  pdf_link: string;
75
75
  new_chat_messages: number;
76
- pc_tags: string[];
77
76
  }
78
77
 
79
78
  export interface DocumentHeaderNoteCreateRequest {
@@ -15,9 +15,7 @@ const emailSchema = joi
15
15
  .string()
16
16
  .trim(true)
17
17
  .lowercase()
18
- .email({ tlds: { allow: false } })
19
- .allow(null, '');
20
-
18
+ .email({ tlds: { allow: false } });
21
19
  // create body validation
22
20
  const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
23
21
  name: joi.string().allow(null, '').optional(),
@@ -6,6 +6,7 @@ import {
6
6
  import { IBatchType, IPaymentOrigin } from '../../modules/supply/payment/interface';
7
7
  import { IProductType } from '../../modules/stock/productGoogleSheets/interface';
8
8
  import { IImageType } from '../../modules/stock/productImage/interface';
9
+ import { ITagType } from '../../modules/stock/tag/interface';
9
10
  import { IQueryParameterDatatype } from '../../modules/stock/queryParameter/interfaces';
10
11
  import {
11
12
  IData,
@@ -342,7 +343,6 @@ export type DocumentHeader = {
342
343
  is_void: boolean;
343
344
  origin_id: string | null;
344
345
  who_handles: string | null;
345
- tags: string | null;
346
346
  warning: string | null;
347
347
  created_at: Date;
348
348
  updated_at: Date;
@@ -1304,3 +1304,19 @@ export type DocumentLineMT = {
1304
1304
  created_at: Date;
1305
1305
  updated_at: Date;
1306
1306
  };
1307
+
1308
+ /**
1309
+ * Model Tag
1310
+ *
1311
+ */
1312
+ export type Tag = {
1313
+ id: string;
1314
+ text: string;
1315
+ index: number;
1316
+ type: ITagType;
1317
+ document_header_id: string;
1318
+ created_by: string;
1319
+ updated_by: string;
1320
+ created_at: Date;
1321
+ updated_at: Date;
1322
+ };