@nomalism-com/types 0.37.7 → 0.37.8
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/dist/index.cjs +2 -4
- package/dist/index.js +2 -4
- package/dist/modules/supply/documentSet/interface.d.ts +0 -2
- package/dist/shared/entities/stock.d.ts +0 -1
- package/package.json +4 -1
- package/.editorconfig +0 -9
- package/.prettierrc +0 -7
- package/eslint.config.mjs +0 -39
- package/package-lock.json +0 -4327
- package/src/index.ts +0 -3
- package/src/main.ts +0 -672
- package/src/modules/document/billOfLading/interfaces.ts +0 -26
- package/src/modules/document/billOfLading/route.schema.ts +0 -32
- package/src/modules/document/inventario/interface.ts +0 -19
- package/src/modules/document/inventario/route.schema.ts +0 -16
- package/src/modules/document/materialEntrance/interfaces.ts +0 -207
- package/src/modules/document/materialEntrance/route.schema.ts +0 -53
- package/src/modules/document/order/interfaces.ts +0 -172
- package/src/modules/document/order/route.schema.ts +0 -61
- package/src/modules/document/productionOrder/interfaces.ts +0 -12
- package/src/modules/document/productionOrder/route.schema.ts +0 -13
- package/src/modules/document/proforma/interfaces.ts +0 -15
- package/src/modules/document/proforma/route.schema.ts +0 -14
- package/src/modules/document/propostaFornecedor/interfaces.ts +0 -17
- package/src/modules/document/propostaFornecedor/route.schema.ts +0 -21
- package/src/modules/document/propostaSheets/interface.ts +0 -113
- package/src/modules/document/propostaSheets/route.schema.ts +0 -45
- package/src/modules/document/providerCreditNoteFromReturn/interfaces.ts +0 -48
- package/src/modules/document/providerCreditNoteFromReturn/route.schema.ts +0 -41
- package/src/modules/document/providerFinancialCreditNote/interfaces.ts +0 -36
- package/src/modules/document/providerFinancialCreditNote/route.schema.ts +0 -40
- package/src/modules/document/providerServiceInvoice/interfaces.ts +0 -20
- package/src/modules/document/providerServiceInvoice/route.schema.ts +0 -26
- package/src/modules/document/purchase/interfaces.ts +0 -112
- package/src/modules/document/purchase/route.schema.ts +0 -51
- package/src/modules/document/quebra/interfaces.ts +0 -46
- package/src/modules/document/quebra/route.schema.ts +0 -25
- package/src/modules/document/returnToProvider/interface.ts +0 -59
- package/src/modules/document/returnToProvider/route.schema.ts +0 -27
- package/src/modules/document/transformado/interfaces.ts +0 -31
- package/src/modules/document/transformado/route.schema.ts +0 -26
- package/src/modules/document/upfrontReturn/interfaces.ts +0 -17
- package/src/modules/document/upfrontReturn/route.schema.ts +0 -11
- package/src/modules/documentManagement/multimedia/interfaces.ts +0 -22
- package/src/modules/documentManagement/multimedia/route.schema.ts +0 -9
- package/src/modules/integration/emailLog/interfaces.ts +0 -111
- package/src/modules/integration/emailLog/route.schema.ts +0 -18
- package/src/modules/integration/emailTemplate/interfaces.ts +0 -55
- package/src/modules/integration/emailTemplate/route.schema.ts +0 -95
- package/src/modules/integration/emailTemplateAttachment/interfaces.ts +0 -22
- package/src/modules/integration/emailTemplateAttachment/route.schema.ts +0 -12
- package/src/modules/integration/emailVerification/interfaces.ts +0 -30
- package/src/modules/integration/emailVerification/route.schema.ts +0 -34
- package/src/modules/integration/googleFilePermission/interfaces.ts +0 -32
- package/src/modules/integration/googleFilePermission/route.schema.ts +0 -15
- package/src/modules/integration/googleSheets/interfaces.ts +0 -98
- package/src/modules/integration/googleSheets/route.schema.ts +0 -52
- package/src/modules/integration/observation/interfaces.ts +0 -61
- package/src/modules/integration/observation/route.schema.ts +0 -40
- package/src/modules/integration/observationType/interfaces.ts +0 -37
- package/src/modules/integration/observationType/route.schema.ts +0 -17
- package/src/modules/integration/projectInfo/interfaces.ts +0 -26
- package/src/modules/integration/projectInfo/route.schema.ts +0 -18
- package/src/modules/integration/settings/interfaces.ts +0 -31
- package/src/modules/integration/settings/route.schema.ts +0 -24
- package/src/modules/print/npc/interfaces.ts +0 -34
- package/src/modules/print/npc/route.schema.ts +0 -21
- package/src/modules/print/printer/interfaces.ts +0 -47
- package/src/modules/print/printer/route.schema.ts +0 -60
- package/src/modules/print/schedulePrintJob/interfaces.ts +0 -48
- package/src/modules/print/schedulePrintJob/route.schema.ts +0 -39
- package/src/modules/stock/chat/interfaces.ts +0 -82
- package/src/modules/stock/chat/route.schema.ts +0 -28
- package/src/modules/stock/chatRapidMessage/interface.ts +0 -31
- package/src/modules/stock/chatRapidMessage/route.schema.ts +0 -18
- package/src/modules/stock/dashboard/interface.ts +0 -25
- package/src/modules/stock/dashboard/route.schema.ts +0 -11
- package/src/modules/stock/file/interface.ts +0 -37
- package/src/modules/stock/file/route.schema.ts +0 -37
- package/src/modules/stock/location/interface.ts +0 -77
- package/src/modules/stock/location/route.schema.ts +0 -57
- package/src/modules/stock/prison/interface.ts +0 -70
- package/src/modules/stock/prison/route.schema.ts +0 -50
- package/src/modules/stock/productGoogleSheets/interface.ts +0 -339
- package/src/modules/stock/productGoogleSheets/route.schema.ts +0 -146
- package/src/modules/stock/productImage/interface.ts +0 -69
- package/src/modules/stock/productImage/route.schema.ts +0 -52
- package/src/modules/stock/promotion/interface.ts +0 -61
- package/src/modules/stock/promotion/route.schema.ts +0 -39
- package/src/modules/stock/promotionAssoc/interface.ts +0 -62
- package/src/modules/stock/promotionAssoc/route.schema.ts +0 -35
- package/src/modules/stock/queryList/interfaces.ts +0 -56
- package/src/modules/stock/queryList/route.schema.ts +0 -37
- package/src/modules/stock/queryParameter/interfaces.ts +0 -72
- package/src/modules/stock/queryParameter/route.schema.ts +0 -36
- package/src/modules/stock/recurrentTasks/interface.ts +0 -12
- package/src/modules/stock/returnReason/interfaces.ts +0 -23
- package/src/modules/stock/returnReason/route.schema.ts +0 -14
- package/src/modules/stock/savedEmPicking/interfaces.ts +0 -37
- package/src/modules/stock/savedEmPicking/route.schema.ts +0 -113
- package/src/modules/stock/savedProviderProposal/interfaces.ts +0 -32
- package/src/modules/stock/savedProviderProposal/route.schema.ts +0 -16
- package/src/modules/stock/sideMenu/interface.ts +0 -48
- package/src/modules/stock/sideMenu/route.schema.ts +0 -20
- package/src/modules/stock/stockMovement/interface.ts +0 -78
- package/src/modules/stock/stockMovement/route.schema.ts +0 -34
- package/src/modules/stock/tag/interface.ts +0 -36
- package/src/modules/stock/tag/route.schema.ts +0 -30
- package/src/modules/stock/task/interface.ts +0 -126
- package/src/modules/stock/task/route.schema.ts +0 -48
- package/src/modules/stock/taskMessage/interface.ts +0 -18
- package/src/modules/stock/taskMessage/route.schema.ts +0 -19
- package/src/modules/stock/taskRead/interface.ts +0 -17
- package/src/modules/stock/taskRead/route.schema.ts +0 -18
- package/src/modules/stock/typeOfLocation/interface.ts +0 -51
- package/src/modules/stock/typeOfLocation/route.schema.ts +0 -29
- package/src/modules/stock/unitOfMeasure/interface.ts +0 -64
- package/src/modules/stock/unitOfMeasure/route.schema.ts +0 -41
- package/src/modules/stock/vatTax/interface.ts +0 -55
- package/src/modules/stock/vatTax/route.schema.ts +0 -33
- package/src/modules/stock/vatTaxZone/interface.ts +0 -63
- package/src/modules/stock/vatTaxZone/route.schema.ts +0 -42
- package/src/modules/stock/vatValidation/interfaces.ts +0 -10
- package/src/modules/stock/vatValidation/route.schema.ts +0 -8
- package/src/modules/stock/workflow/interfaces.ts +0 -64
- package/src/modules/stock/workflow/route.schema.ts +0 -28
- package/src/modules/supply/batch/interface.ts +0 -0
- package/src/modules/supply/documentHeader/interfaces.ts +0 -497
- package/src/modules/supply/documentHeader/route.schema.ts +0 -371
- package/src/modules/supply/documentHeaderHistory/interfaces.ts +0 -15
- package/src/modules/supply/documentLine/interfaces.ts +0 -210
- package/src/modules/supply/documentLine/route.schema.ts +0 -108
- package/src/modules/supply/documentLineAssoc/interfaces.ts +0 -52
- package/src/modules/supply/documentLineAssoc/route.schema.ts +0 -16
- package/src/modules/supply/documentLineMT/interface.ts +0 -27
- package/src/modules/supply/documentLineMT/route.schema.ts +0 -18
- package/src/modules/supply/documentLineNote/interfaces.ts +0 -53
- package/src/modules/supply/documentLineNote/route.schema.ts +0 -19
- package/src/modules/supply/documentLineRM/interface.ts +0 -34
- package/src/modules/supply/documentLineRM/route.schema.ts +0 -25
- package/src/modules/supply/documentSet/interface.ts +0 -31
- package/src/modules/supply/documentSet/route.schema.ts +0 -20
- package/src/modules/supply/documentType/interfaces.ts +0 -214
- package/src/modules/supply/documentType/route.schema.ts +0 -75
- package/src/modules/supply/externalDocumentHeader/interface.ts +0 -120
- package/src/modules/supply/externalDocumentHeader/route.schema.ts +0 -79
- package/src/modules/supply/externalDocumentType/interface.ts +0 -14
- package/src/modules/supply/orderManagement/interface.ts +0 -49
- package/src/modules/supply/orderManagement/route.schema.ts +0 -0
- package/src/modules/supply/payment/interface.ts +0 -229
- package/src/modules/supply/payment/route.schema.ts +0 -122
- package/src/modules/supply/preSale/interface.ts +0 -92
- package/src/modules/supply/preSale/route.schema.ts +0 -75
- package/src/modules/supply/preSaleProduct/interface.ts +0 -16
- package/src/modules/supply/preSaleProduct/route.schema.ts +0 -7
- package/src/modules/supply/schedule/interface.ts +0 -47
- package/src/modules/supply/schedule/route.schema.ts +0 -14
- package/src/modules/supply/startDocumentHeaderLastUpdate/interface.ts +0 -15
- package/src/modules/tickets/channel/interfaces.ts +0 -35
- package/src/modules/tickets/channel/route.schema.ts +0 -24
- package/src/modules/tickets/clt/interfaces.ts +0 -26
- package/src/modules/tickets/clt/route.schema.ts +0 -24
- package/src/modules/tickets/language/interfaces.ts +0 -25
- package/src/modules/tickets/language/route.schema.ts +0 -28
- package/src/modules/tickets/tickets/interfaces.ts +0 -80
- package/src/modules/tickets/tickets/route.schema.ts +0 -19
- package/src/modules/user/bankData/interface.ts +0 -64
- package/src/modules/user/bankData/route.schema.ts +0 -40
- package/src/modules/user/chatSubscribers/interfaces.ts +0 -34
- package/src/modules/user/chatSubscribers/route.schema.ts +0 -12
- package/src/modules/user/clientType/interface.ts +0 -47
- package/src/modules/user/clientType/route.schema.ts +0 -31
- package/src/modules/user/clients/interface.ts +0 -138
- package/src/modules/user/clients/route.schema.ts +0 -87
- package/src/modules/user/commissioner/interface.ts +0 -110
- package/src/modules/user/commissioner/route.schema.ts +0 -65
- package/src/modules/user/country/interface.ts +0 -54
- package/src/modules/user/country/route.schema.ts +0 -36
- package/src/modules/user/deliveryMethods/interfaces.ts +0 -28
- package/src/modules/user/deliveryMethods/route.schema.ts +0 -15
- package/src/modules/user/favorites/interfaces.ts +0 -28
- package/src/modules/user/favorites/route.schema.ts +0 -19
- package/src/modules/user/groupPermissions/interface.ts +0 -32
- package/src/modules/user/groupPermissions/route.schema.ts +0 -11
- package/src/modules/user/language/interface.ts +0 -47
- package/src/modules/user/language/route.schema.ts +0 -28
- package/src/modules/user/maturityDates/interfaces.ts +0 -31
- package/src/modules/user/maturityDates/route.schema.ts +0 -18
- package/src/modules/user/password/interfaces.ts +0 -21
- package/src/modules/user/password/route.schema.ts +0 -22
- package/src/modules/user/paymentMethods/interfaces.ts +0 -72
- package/src/modules/user/paymentMethods/route.schema.ts +0 -27
- package/src/modules/user/permissions/interface.ts +0 -34
- package/src/modules/user/permissions/route.schema.ts +0 -11
- package/src/modules/user/persona/interface.ts +0 -157
- package/src/modules/user/persona/route.schema.ts +0 -101
- package/src/modules/user/providerType/interface.ts +0 -47
- package/src/modules/user/providerType/route.schema.ts +0 -28
- package/src/modules/user/providers/interface.ts +0 -130
- package/src/modules/user/providers/route.schema.ts +0 -85
- package/src/modules/user/purchaseConditions/interface.ts +0 -58
- package/src/modules/user/purchaseConditions/route.schema.ts +0 -33
- package/src/modules/user/reasonForExemption/interface.ts +0 -53
- package/src/modules/user/reasonForExemption/route.schema.ts +0 -34
- package/src/modules/user/refreshToken/interface.ts +0 -19
- package/src/modules/user/refreshToken/route.schema.ts +0 -10
- package/src/modules/user/segmentsArea/interface.ts +0 -49
- package/src/modules/user/segmentsArea/route.schema.ts +0 -30
- package/src/modules/user/sessions/interface.ts +0 -24
- package/src/modules/user/sessions/route.schema.ts +0 -10
- package/src/modules/user/shippings/interface.ts +0 -57
- package/src/modules/user/shippings/route.schema.ts +0 -35
- package/src/modules/user/storeOperator/interface.ts +0 -42
- package/src/modules/user/storeOperator/route.schema.ts +0 -45
- package/src/modules/user/swift/interface.ts +0 -55
- package/src/modules/user/swift/route.schema.ts +0 -36
- package/src/modules/user/tenant/interface.ts +0 -59
- package/src/modules/user/tenant/route.schema.ts +0 -46
- package/src/modules/user/theme/interfaces.ts +0 -21
- package/src/modules/user/theme/route.schema.ts +0 -19
- package/src/modules/user/userPermissions/interface.ts +0 -28
- package/src/modules/user/userPermissions/route.schema.ts +0 -12
- package/src/modules/user/userPositions/interface.ts +0 -47
- package/src/modules/user/userPositions/route.schema.ts +0 -29
- package/src/modules/user/userTokens/interface.ts +0 -41
- package/src/modules/user/userTokens/route.schema.ts +0 -17
- package/src/modules/user/users/interface.ts +0 -177
- package/src/modules/user/users/route.schema.ts +0 -58
- package/src/modules/user/vehicles/interfaces.ts +0 -31
- package/src/modules/user/vehicles/route.schema.ts +0 -17
- package/src/modules/user/zipCode/interfaces.ts +0 -27
- package/src/modules/user/zipCode/route.schema.ts +0 -26
- package/src/modules/view/adminPanel/interfaces.ts +0 -180
- package/src/modules/view/errorLog/interfaces.ts +0 -36
- package/src/modules/view/errorLog/route.schema.ts +0 -25
- package/src/shared/entities/documentManagement.ts +0 -16
- package/src/shared/entities/integration.ts +0 -136
- package/src/shared/entities/print.ts +0 -49
- package/src/shared/entities/stock.ts +0 -1248
- package/src/shared/entities/tickets.ts +0 -82
- package/src/shared/entities/user.ts +0 -540
- package/src/shared/errors/documentManagementErrors.ts +0 -13
- package/src/shared/errors/integrationErrors.ts +0 -44
- package/src/shared/errors/stockErrors.ts +0 -267
- package/src/shared/errors/userErrors.ts +0 -108
- package/src/shared/errors/viewErrors.ts +0 -6
- package/src/shared/interface.ts +0 -548
- package/src/shared/messages.ts +0 -141
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -10
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { StockMovement } from '../../../shared/entities/stock';
|
|
3
|
-
|
|
4
|
-
export type Entity = StockMovement;
|
|
5
|
-
export const Route = 'stock_movement';
|
|
6
|
-
export const UpperName = 'StockMovement';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface IFindByProviderResponse
|
|
10
|
-
extends Omit<StockMovement, 'product_id' | 'stock_to_date'> {
|
|
11
|
-
reference: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type IFindByOwnerIdResponse = Omit<StockMovement, 'document_line_id' | 'product_id'>;
|
|
15
|
-
|
|
16
|
-
export const ExportFormatEnum: {
|
|
17
|
-
csv: 'csv';
|
|
18
|
-
xml: 'xml';
|
|
19
|
-
} = {
|
|
20
|
-
csv: 'csv',
|
|
21
|
-
xml: 'xml',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type IExportFormat = (typeof ExportFormatEnum)[keyof typeof ExportFormatEnum];
|
|
25
|
-
|
|
26
|
-
export const exportFormats = Object.keys(ExportFormatEnum);
|
|
27
|
-
|
|
28
|
-
export const ExportVersionEnum: {
|
|
29
|
-
v1_02: 'v1_02';
|
|
30
|
-
v2_01: 'v2_01';
|
|
31
|
-
} = {
|
|
32
|
-
v1_02: 'v1_02',
|
|
33
|
-
v2_01: 'v2_01',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type IExportVersion = (typeof ExportVersionEnum)[keyof typeof ExportVersionEnum];
|
|
37
|
-
|
|
38
|
-
export const exportVersions = Object.keys(ExportVersionEnum);
|
|
39
|
-
|
|
40
|
-
export interface IExportRequest {
|
|
41
|
-
date: Date;
|
|
42
|
-
format: IExportFormat;
|
|
43
|
-
version: IExportVersion;
|
|
44
|
-
token: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// https://info.portaldasfinancas.gov.pt/pt/apoio_contribuinte/Comunicacao_inventarios_exist%C3%AAncias/Documents/comunicacaoinventarios.pdf
|
|
48
|
-
export interface IExportCsvResponse {
|
|
49
|
-
productCategory: string;
|
|
50
|
-
productCode: string;
|
|
51
|
-
productDescription: string;
|
|
52
|
-
productNumberCode: string;
|
|
53
|
-
closingStockQuantity: number;
|
|
54
|
-
unitOfMeasure: string;
|
|
55
|
-
closingStockValue: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface IFindStockMovementPaginatedRequest
|
|
59
|
-
extends IShared.IFindByOwnerIdRequest,
|
|
60
|
-
IShared.IPaginationRequest {}
|
|
61
|
-
|
|
62
|
-
export interface IRepository {
|
|
63
|
-
findByProvider(selector: IShared.IFindByIdNumberRequest): Promise<IFindByProviderResponse[]>;
|
|
64
|
-
|
|
65
|
-
findByOwnerId(selector: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
|
|
66
|
-
|
|
67
|
-
exportCsv(selector: IExportRequest): Promise<IExportCsvResponse[]>;
|
|
68
|
-
|
|
69
|
-
findStockMovementPaginated(
|
|
70
|
-
selector: IFindStockMovementPaginatedRequest,
|
|
71
|
-
): Promise<IShared.IPaginationResponse<IFindByOwnerIdResponse>>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface IController extends IRepository {
|
|
75
|
-
findByOwnerId(selector: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
|
|
76
|
-
|
|
77
|
-
exportCsv(selector: IExportRequest): Promise<IExportCsvResponse[]>;
|
|
78
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import {
|
|
5
|
-
IExportRequest,
|
|
6
|
-
exportVersions,
|
|
7
|
-
exportFormats,
|
|
8
|
-
IFindStockMovementPaginatedRequest,
|
|
9
|
-
} from './interface';
|
|
10
|
-
|
|
11
|
-
const exportCsvQueryKeys: IShared.IRouteRequest<IExportRequest> = {
|
|
12
|
-
date: joi.date().required(),
|
|
13
|
-
format: joi
|
|
14
|
-
.string()
|
|
15
|
-
.valid(...exportFormats)
|
|
16
|
-
.required(),
|
|
17
|
-
version: joi
|
|
18
|
-
.string()
|
|
19
|
-
.valid(...exportVersions)
|
|
20
|
-
.required(),
|
|
21
|
-
token: joi.string().required(),
|
|
22
|
-
};
|
|
23
|
-
export const exportCsvQuery = joi.object().keys(exportCsvQueryKeys).messages(messages);
|
|
24
|
-
|
|
25
|
-
// find with pagination query validation
|
|
26
|
-
const findWithPaginationQueryKeys: IShared.IRouteRequest<IFindStockMovementPaginatedRequest> = {
|
|
27
|
-
owner_id: joi.string().uuid().required(),
|
|
28
|
-
per_page: joi.number().integer().positive().default(10).optional(),
|
|
29
|
-
current_page: joi.number().integer().positive().default(1).optional(),
|
|
30
|
-
};
|
|
31
|
-
export const findStockMovementWithPaginationQuery = joi
|
|
32
|
-
.object()
|
|
33
|
-
.keys(findWithPaginationQueryKeys)
|
|
34
|
-
.messages(messages);
|
|
@@ -1,36 +0,0 @@
|
|
|
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<
|
|
23
|
-
Entity,
|
|
24
|
-
'id' | 'created_at' | 'updated_at' | 'created_by' | 'updated_by'
|
|
25
|
-
>;
|
|
26
|
-
export type IUpdateManyRequest = Pick<Entity, 'id' | 'index' | 'type'>;
|
|
27
|
-
export type IFindResponse = Omit<Entity, 'created_at' | 'updated_at'>;
|
|
28
|
-
|
|
29
|
-
export interface IRepository {
|
|
30
|
-
create(data: ICreateRequest): Promise<void>;
|
|
31
|
-
findByDocumentHeaderId(selector: IShared.IFindByIdRequest): Promise<IFindResponse[]>;
|
|
32
|
-
updateMany(data: IUpdateManyRequest[]): Promise<void>;
|
|
33
|
-
delete(selector: IShared.IFindByIdRequest): Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { ICreateRequest, IUpdateManyRequest, ITagType } 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
|
|
12
|
-
.string()
|
|
13
|
-
.valid(...ITagType)
|
|
14
|
-
.required(),
|
|
15
|
-
};
|
|
16
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
17
|
-
|
|
18
|
-
// update body validation
|
|
19
|
-
const updateManyBodyKeys: IShared.IRouteRequest<IUpdateManyRequest> = {
|
|
20
|
-
id: joi.string().uuid().required(),
|
|
21
|
-
index: joi.number().allow(0).optional(),
|
|
22
|
-
type: joi
|
|
23
|
-
.string()
|
|
24
|
-
.valid(...ITagType)
|
|
25
|
-
.optional(),
|
|
26
|
-
};
|
|
27
|
-
export const updateManyBody = joi
|
|
28
|
-
.array()
|
|
29
|
-
.items(joi.object().keys(updateManyBodyKeys))
|
|
30
|
-
.messages(messages);
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Task, TaskMessage, DocumentHeader, File } from '../../../shared/entities/stock';
|
|
3
|
-
|
|
4
|
-
export type Entity = Task;
|
|
5
|
-
export const Route = 'task';
|
|
6
|
-
export const UpperName = 'Task';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export const ITaskStatusDataTypeEnum: {
|
|
10
|
-
Normal: 'Normal';
|
|
11
|
-
Urgent: 'Urgent';
|
|
12
|
-
Problem: 'Problem';
|
|
13
|
-
} = {
|
|
14
|
-
Normal: 'Normal',
|
|
15
|
-
Urgent: 'Urgent',
|
|
16
|
-
Problem: 'Problem',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type ITaskStatusDataType =
|
|
20
|
-
(typeof ITaskStatusDataTypeEnum)[keyof typeof ITaskStatusDataTypeEnum];
|
|
21
|
-
|
|
22
|
-
export const taskStatusDataType = Object.keys(ITaskStatusDataTypeEnum);
|
|
23
|
-
|
|
24
|
-
export type ICreateRequest = {
|
|
25
|
-
task: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type ICreateFromDossierRequest = {
|
|
29
|
-
from: string;
|
|
30
|
-
to: string | null;
|
|
31
|
-
task: string;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type IUpdateRequest = {
|
|
35
|
-
from?: string;
|
|
36
|
-
to?: string | null;
|
|
37
|
-
task?: string;
|
|
38
|
-
read?: boolean;
|
|
39
|
-
finished?: boolean;
|
|
40
|
-
archived?: boolean;
|
|
41
|
-
status?: ITaskStatusDataType;
|
|
42
|
-
future_date?: Date | null;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const IHistoryStatusDataTypeEnum: {
|
|
46
|
-
created_task: 'created_task';
|
|
47
|
-
updated_task: 'updated_task';
|
|
48
|
-
created_message: 'created_message';
|
|
49
|
-
updated_message: 'updated_message';
|
|
50
|
-
deleted_message: 'deleted_message';
|
|
51
|
-
} = {
|
|
52
|
-
created_task: 'created_task',
|
|
53
|
-
updated_task: 'updated_task',
|
|
54
|
-
created_message: 'created_message',
|
|
55
|
-
updated_message: 'updated_message',
|
|
56
|
-
deleted_message: 'deleted_message',
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export type IHistoryStatusDataType =
|
|
60
|
-
(typeof IHistoryStatusDataTypeEnum)[keyof typeof IHistoryStatusDataTypeEnum];
|
|
61
|
-
|
|
62
|
-
export const historyStatusDataType = Object.keys(IHistoryStatusDataTypeEnum);
|
|
63
|
-
|
|
64
|
-
export interface ITaskHistoryData {
|
|
65
|
-
status: IHistoryStatusDataType | null;
|
|
66
|
-
data: string;
|
|
67
|
-
changedAt: Date;
|
|
68
|
-
changedBy: string;
|
|
69
|
-
}
|
|
70
|
-
export interface ITaskHistoryResponse {
|
|
71
|
-
status: IHistoryStatusDataType | null;
|
|
72
|
-
data: string;
|
|
73
|
-
changedAt: Date;
|
|
74
|
-
changedBy: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export type IFindResponse = Omit<Entity, 'history'> & {
|
|
78
|
-
task_read: boolean;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type ITaskFileType = Pick<
|
|
82
|
-
File,
|
|
83
|
-
'multimedia_id' | 'filename' | 'created_at' | 'created_by'
|
|
84
|
-
> & {
|
|
85
|
-
id?: string;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export interface IFindWithMessagesResponse extends Entity {
|
|
89
|
-
messages: TaskMessage[];
|
|
90
|
-
document_headers: Pick<DocumentHeader, 'id' | 'document_number'>[];
|
|
91
|
-
task_read: boolean;
|
|
92
|
-
task_files: ITaskFileType[];
|
|
93
|
-
}
|
|
94
|
-
export type IFindTasksRequest = {
|
|
95
|
-
archived?: boolean;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export type IFindByOwnerResponse = {
|
|
99
|
-
task_id: string;
|
|
100
|
-
from: string;
|
|
101
|
-
to: string | null;
|
|
102
|
-
task: string;
|
|
103
|
-
created_at: Date;
|
|
104
|
-
task_read: boolean;
|
|
105
|
-
number: number;
|
|
106
|
-
status: ITaskStatusDataType;
|
|
107
|
-
future_date: Date | null;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export interface IRepository {
|
|
111
|
-
find(selector: IFindTasksRequest): Promise<IFindResponse[]>;
|
|
112
|
-
|
|
113
|
-
findWithMessages(id: IShared.IFindByIdRequest): Promise<IFindWithMessagesResponse>;
|
|
114
|
-
|
|
115
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
116
|
-
|
|
117
|
-
createFromDossier(data: ICreateFromDossierRequest): Promise<Entity>;
|
|
118
|
-
|
|
119
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
|
|
120
|
-
|
|
121
|
-
delete(selector: IShared.IFindByIdRequest): Promise<void>;
|
|
122
|
-
|
|
123
|
-
findByOwnerId: (selector: IShared.IFindByOwnerIdRequest) => Promise<IFindByOwnerResponse[]>;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import {
|
|
5
|
-
ICreateRequest,
|
|
6
|
-
IUpdateRequest,
|
|
7
|
-
IFindTasksRequest,
|
|
8
|
-
taskStatusDataType,
|
|
9
|
-
ICreateFromDossierRequest,
|
|
10
|
-
} from './interface';
|
|
11
|
-
|
|
12
|
-
// create body validation
|
|
13
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
14
|
-
task: joi.string().required(),
|
|
15
|
-
};
|
|
16
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
17
|
-
|
|
18
|
-
// createFromDossier body validation
|
|
19
|
-
const createFromDossierBodyKeys: IShared.IRouteRequest<ICreateFromDossierRequest> = {
|
|
20
|
-
from: joi.string().uuid().required(),
|
|
21
|
-
to: joi.string().uuid().allow(null).required(),
|
|
22
|
-
task: joi.string().required(),
|
|
23
|
-
};
|
|
24
|
-
export const createFromDossierBody = joi
|
|
25
|
-
.object()
|
|
26
|
-
.keys(createFromDossierBodyKeys)
|
|
27
|
-
.messages(messages);
|
|
28
|
-
|
|
29
|
-
// update body validation
|
|
30
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
31
|
-
from: joi.string().uuid().optional(),
|
|
32
|
-
to: joi.string().uuid().allow(null).optional(),
|
|
33
|
-
task: joi.string().optional(),
|
|
34
|
-
read: joi.boolean().optional(),
|
|
35
|
-
finished: joi.boolean().optional(),
|
|
36
|
-
archived: joi.boolean().optional(),
|
|
37
|
-
future_date: joi.date().allow(null, '').optional(),
|
|
38
|
-
status: joi
|
|
39
|
-
.string()
|
|
40
|
-
.valid(...taskStatusDataType)
|
|
41
|
-
.optional(),
|
|
42
|
-
};
|
|
43
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
44
|
-
|
|
45
|
-
const findTaskParamsKeys: IShared.IRouteRequest<IFindTasksRequest> = {
|
|
46
|
-
archived: joi.boolean().optional(),
|
|
47
|
-
};
|
|
48
|
-
export const findTaskParams = joi.object().keys(findTaskParamsKeys).messages(messages);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { TaskMessage } from '../../../shared/entities/stock';
|
|
3
|
-
|
|
4
|
-
export type Entity = TaskMessage;
|
|
5
|
-
export const Route = 'task_message';
|
|
6
|
-
export const UpperName = 'TaskMessage';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export type ICreateRequest = Pick<Entity, 'message' | 'task_id'>;
|
|
10
|
-
export type IUpdateRequest = Pick<Entity, 'message' | 'task_id'>;
|
|
11
|
-
|
|
12
|
-
export interface IRepository {
|
|
13
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
14
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
|
|
15
|
-
delete(selector: IShared.IFindByIdRequest): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
task_id: joi.string().uuid().required(),
|
|
9
|
-
message: joi.string().required(),
|
|
10
|
-
};
|
|
11
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
12
|
-
|
|
13
|
-
// update body validation
|
|
14
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
15
|
-
task_id: joi.string().uuid().required(),
|
|
16
|
-
message: joi.string().required(),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { TaskRead } from '../../../shared/entities/stock';
|
|
3
|
-
|
|
4
|
-
export type Entity = TaskRead;
|
|
5
|
-
export const Route = 'task_read';
|
|
6
|
-
export const UpperName = 'TaskRead';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export type ICreateRequest = Pick<Entity, 'user_id' | 'task_id'>;
|
|
10
|
-
export type IDeleteRequest = Pick<Entity, 'user_id' | 'task_id'>;
|
|
11
|
-
|
|
12
|
-
export interface IRepository {
|
|
13
|
-
create(data: ICreateRequest): Promise<void>;
|
|
14
|
-
delete(selector: IDeleteRequest): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { ICreateRequest, IDeleteRequest } from './interface';
|
|
5
|
-
|
|
6
|
-
// create body validation
|
|
7
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
|
-
task_id: joi.string().uuid().required(),
|
|
9
|
-
user_id: joi.string().uuid().required(),
|
|
10
|
-
};
|
|
11
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
12
|
-
|
|
13
|
-
// delete params validation
|
|
14
|
-
const deleteParamsKeys: IShared.IRouteRequest<IDeleteRequest> = {
|
|
15
|
-
task_id: joi.string().uuid().required(),
|
|
16
|
-
user_id: joi.string().uuid().required(),
|
|
17
|
-
};
|
|
18
|
-
export const deleteBody = joi.object().keys(deleteParamsKeys).messages(messages);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { TypeOfLocation } from '../../../shared/entities/stock';
|
|
3
|
-
|
|
4
|
-
export type Entity = TypeOfLocation;
|
|
5
|
-
export const Route = 'type_of_location';
|
|
6
|
-
export const UpperName = 'TypeOfLocation';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
type IFindDetailedResponse = Entity;
|
|
10
|
-
|
|
11
|
-
// omit any unnecessary fields
|
|
12
|
-
export type IFindByIdResponse = Omit<IFindDetailedResponse, ''>;
|
|
13
|
-
|
|
14
|
-
// omit any unnecessary fields
|
|
15
|
-
export type IFindByOwnerIdResponse = Omit<IFindDetailedResponse, ''>;
|
|
16
|
-
|
|
17
|
-
export type IFindRequest = Record<string, unknown>;
|
|
18
|
-
|
|
19
|
-
// omit any unnecessary fields
|
|
20
|
-
export type IFindResponse = Omit<IFindDetailedResponse, ''>;
|
|
21
|
-
|
|
22
|
-
export interface IFindPaginatedRequest extends IFindRequest, IShared.IPaginationRequest {}
|
|
23
|
-
|
|
24
|
-
export type IFindWithPaginationResponse = IShared.IPaginationResponse<
|
|
25
|
-
Omit<IFindDetailedResponse, ''>
|
|
26
|
-
>;
|
|
27
|
-
|
|
28
|
-
export interface ICreateRequest {
|
|
29
|
-
// create fields
|
|
30
|
-
name: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface IUpdateRequest {
|
|
34
|
-
// updatable fields
|
|
35
|
-
name?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface IRepository {
|
|
39
|
-
findById(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse | null>;
|
|
40
|
-
|
|
41
|
-
findByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
|
|
42
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
43
|
-
find(selector: IFindRequest): Promise<IFindResponse[]>;
|
|
44
|
-
findPaginated(selector: IFindPaginatedRequest): Promise<IFindWithPaginationResponse>;
|
|
45
|
-
|
|
46
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
47
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
48
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { IFindRequest, IFindPaginatedRequest, ICreateRequest, IUpdateRequest } from './interface';
|
|
5
|
-
|
|
6
|
-
// create body validation
|
|
7
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
|
-
name: joi.string().required(),
|
|
9
|
-
};
|
|
10
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
11
|
-
|
|
12
|
-
// update body validation
|
|
13
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
14
|
-
name: joi.string().optional(),
|
|
15
|
-
};
|
|
16
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
17
|
-
|
|
18
|
-
const findQueryKeys: IShared.IRouteRequest<IFindRequest> = {};
|
|
19
|
-
export const findQuery = joi.object().keys(findQueryKeys).messages(messages);
|
|
20
|
-
|
|
21
|
-
// find with pagination query validation
|
|
22
|
-
const findWithPaginationQueryKeys: IShared.IRouteRequest<IFindPaginatedRequest> = {
|
|
23
|
-
per_page: joi.number().integer().positive().default(10).optional(),
|
|
24
|
-
current_page: joi.number().integer().positive().default(1).optional(),
|
|
25
|
-
};
|
|
26
|
-
export const findWithPaginationQuery = joi
|
|
27
|
-
.object()
|
|
28
|
-
.keys(findWithPaginationQueryKeys)
|
|
29
|
-
.messages(messages);
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { UnitOfMeasure } from '../../../shared/entities/stock';
|
|
3
|
-
|
|
4
|
-
export type Entity = UnitOfMeasure;
|
|
5
|
-
|
|
6
|
-
export const UpperName = 'UnitOfMeasure';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
export const Route = 'unit_of_measure';
|
|
9
|
-
|
|
10
|
-
type IFindDetailedResponse = Entity;
|
|
11
|
-
|
|
12
|
-
// omit any unnecessary fields
|
|
13
|
-
export type IFindByIdResponse = Omit<IFindDetailedResponse, ''>;
|
|
14
|
-
|
|
15
|
-
// omit any unnecessary fields
|
|
16
|
-
export type IFindByOwnerIdResponse = Omit<IFindDetailedResponse, ''>;
|
|
17
|
-
|
|
18
|
-
export type IFindRequest = Record<string, unknown>;
|
|
19
|
-
|
|
20
|
-
// omit any unnecessary fields
|
|
21
|
-
export type IFindResponse = Omit<IFindDetailedResponse, ''>;
|
|
22
|
-
|
|
23
|
-
export interface IFindPaginatedRequest extends IFindRequest, IShared.IPaginationRequest {}
|
|
24
|
-
|
|
25
|
-
export type IFindWithPaginationResponse = IShared.IPaginationResponse<
|
|
26
|
-
Omit<IFindDetailedResponse, ''>
|
|
27
|
-
>;
|
|
28
|
-
|
|
29
|
-
export interface ICreateRequest {
|
|
30
|
-
// create fields
|
|
31
|
-
name: string;
|
|
32
|
-
notation: string;
|
|
33
|
-
type: string;
|
|
34
|
-
external_id?: string | null;
|
|
35
|
-
default_quantity?: boolean;
|
|
36
|
-
integer_only?: boolean;
|
|
37
|
-
divisible?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface IUpdateRequest {
|
|
41
|
-
// updatable fields
|
|
42
|
-
name?: string;
|
|
43
|
-
notation?: string;
|
|
44
|
-
type?: string;
|
|
45
|
-
external_id?: string | null;
|
|
46
|
-
default_quantity?: boolean;
|
|
47
|
-
integer_only?: boolean;
|
|
48
|
-
divisible?: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface IRepository {
|
|
52
|
-
findById(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse | null>;
|
|
53
|
-
|
|
54
|
-
findByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
|
|
55
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
56
|
-
find(selector: IFindRequest): Promise<IFindResponse[]>;
|
|
57
|
-
findPaginated(selector: IFindPaginatedRequest): Promise<IFindWithPaginationResponse>;
|
|
58
|
-
|
|
59
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
60
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
61
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { IFindRequest, IFindPaginatedRequest, ICreateRequest, IUpdateRequest } from './interface';
|
|
5
|
-
|
|
6
|
-
// create body validation
|
|
7
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
|
-
name: joi.string().required(),
|
|
9
|
-
notation: joi.string().required(),
|
|
10
|
-
type: joi.string().valid('length', 'area', 'mass', 'volume').required(),
|
|
11
|
-
external_id: joi.string().allow(null).optional(),
|
|
12
|
-
default_quantity: joi.boolean().optional(),
|
|
13
|
-
divisible: joi.boolean().optional(),
|
|
14
|
-
integer_only: joi.boolean().optional(),
|
|
15
|
-
};
|
|
16
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
17
|
-
|
|
18
|
-
// update body validation
|
|
19
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
20
|
-
name: joi.string().optional(),
|
|
21
|
-
notation: joi.string().optional(),
|
|
22
|
-
type: joi.string().valid('length', 'area', 'mass', 'volume').optional(),
|
|
23
|
-
external_id: joi.string().allow(null).optional(),
|
|
24
|
-
default_quantity: joi.boolean().optional(),
|
|
25
|
-
divisible: joi.boolean().optional(),
|
|
26
|
-
integer_only: joi.boolean().optional(),
|
|
27
|
-
};
|
|
28
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
29
|
-
|
|
30
|
-
const findQueryKeys: IShared.IRouteRequest<IFindRequest> = {};
|
|
31
|
-
export const findQuery = joi.object().keys(findQueryKeys).messages(messages);
|
|
32
|
-
|
|
33
|
-
// find with pagination query validation
|
|
34
|
-
const findWithPaginationQueryKeys: IShared.IRouteRequest<IFindPaginatedRequest> = {
|
|
35
|
-
per_page: joi.number().integer().positive().default(10).optional(),
|
|
36
|
-
current_page: joi.number().integer().positive().default(1).optional(),
|
|
37
|
-
};
|
|
38
|
-
export const findWithPaginationQuery = joi
|
|
39
|
-
.object()
|
|
40
|
-
.keys(findWithPaginationQueryKeys)
|
|
41
|
-
.messages(messages);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { VatTax } from '../../../shared/entities/stock';
|
|
3
|
-
|
|
4
|
-
export type Entity = VatTax;
|
|
5
|
-
export const Route = 'vat_tax';
|
|
6
|
-
export const UpperName = 'VatTax';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
type IFindDetailedResponse = Entity;
|
|
10
|
-
|
|
11
|
-
// omit any unnecessary fields
|
|
12
|
-
export type IFindByIdResponse = Omit<IFindDetailedResponse, ''>;
|
|
13
|
-
|
|
14
|
-
// omit any unnecessary fields
|
|
15
|
-
export type IFindByOwnerIdResponse = Omit<IFindDetailedResponse, ''>;
|
|
16
|
-
|
|
17
|
-
export type IFindRequest = Record<string, unknown>;
|
|
18
|
-
|
|
19
|
-
// omit any unnecessary fields
|
|
20
|
-
export type IFindResponse = Omit<IFindDetailedResponse, ''>;
|
|
21
|
-
|
|
22
|
-
export interface IFindPaginatedRequest extends IFindRequest, IShared.IPaginationRequest {}
|
|
23
|
-
|
|
24
|
-
export type IFindWithPaginationResponse = IShared.IPaginationResponse<
|
|
25
|
-
Omit<IFindDetailedResponse, ''>
|
|
26
|
-
>;
|
|
27
|
-
|
|
28
|
-
export interface ICreateRequest {
|
|
29
|
-
// create fields
|
|
30
|
-
name: string;
|
|
31
|
-
saft_code: string;
|
|
32
|
-
external_id?: string | null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface IUpdateRequest {
|
|
36
|
-
// updatable fields
|
|
37
|
-
name?: string;
|
|
38
|
-
saft_code?: string;
|
|
39
|
-
external_id?: string | null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface IRepository {
|
|
43
|
-
findById(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse | null>;
|
|
44
|
-
|
|
45
|
-
findByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
|
|
46
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
47
|
-
find(selector: IFindRequest): Promise<IFindResponse[]>;
|
|
48
|
-
findPaginated(selector: IFindPaginatedRequest): Promise<IFindWithPaginationResponse>;
|
|
49
|
-
|
|
50
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
51
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
52
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|