@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,52 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import { ICloneRequest, IUpdateRequest, IGetUserData, IExportRequest } from './interfaces';
|
|
4
|
-
import * as IShared from '../../../shared/interface';
|
|
5
|
-
|
|
6
|
-
const cloneQueryKeys: IShared.IRouteRequest<ICloneRequest> = {
|
|
7
|
-
document_name: joi.string().allow(null).optional(),
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const cloneQuery = joi.object().keys(cloneQueryKeys).messages(messages);
|
|
11
|
-
|
|
12
|
-
const exportQueryKeys: IShared.IRouteRequest<IExportRequest> = {
|
|
13
|
-
document_header_id: joi.string().uuid().required(),
|
|
14
|
-
spreadsheetId: joi.string().required(),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const exportQuery = joi.object().keys(exportQueryKeys).messages(messages);
|
|
18
|
-
|
|
19
|
-
const userData: IShared.IRouteRequestWithStamps<IGetUserData> = {
|
|
20
|
-
document_number: joi.number().optional(),
|
|
21
|
-
emission_date: joi.date().optional(),
|
|
22
|
-
owner_number: joi.number().optional(),
|
|
23
|
-
contact_persona_name: joi.string().optional(),
|
|
24
|
-
contact_persona_email: joi.string().trim(true).lowercase().optional(),
|
|
25
|
-
contact_persona_telephone: joi.string().optional(),
|
|
26
|
-
billing_persona_nif: joi.string().optional(),
|
|
27
|
-
billing_persona_name: joi.string().optional(),
|
|
28
|
-
billing_persona_email: joi.string().trim(true).lowercase().optional(),
|
|
29
|
-
billing_persona_telephone: joi.string().optional(),
|
|
30
|
-
billing_persona_address_street: joi.string().optional(),
|
|
31
|
-
billing_persona_address_locality: joi.string().optional(),
|
|
32
|
-
billing_persona_address_postal_code: joi.string().trim(true).lowercase().optional(),
|
|
33
|
-
billing_persona_address_country_name: joi.string().optional(),
|
|
34
|
-
delivery_persona_name: joi.string().optional(),
|
|
35
|
-
delivery_persona_email: joi.string().trim(true).lowercase().optional(),
|
|
36
|
-
delivery_persona_telephone: joi.string().optional(),
|
|
37
|
-
delivery_persona_address_street: joi.string().optional(),
|
|
38
|
-
delivery_persona_address_locality: joi.string().optional(),
|
|
39
|
-
delivery_persona_address_postal_code: joi.string().trim(true).lowercase().optional(),
|
|
40
|
-
delivery_persona_address_country_name: joi.string().optional(),
|
|
41
|
-
reason_for_exemption_name: joi.string().required().allow(null),
|
|
42
|
-
store_operator_id: joi.string().required().allow(null),
|
|
43
|
-
store_operator_name: joi.string().required().allow(null),
|
|
44
|
-
store_operator_number: joi.number().required().allow(null),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const updateQueryKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
48
|
-
document_name: joi.string().required(),
|
|
49
|
-
client_data: joi.object().keys(userData).optional(),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const updateQuery = joi.object().keys(updateQueryKeys).messages(messages);
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Observation, ObservationType } from '../../../shared/entities/integration';
|
|
3
|
-
|
|
4
|
-
export type Entity = Observation;
|
|
5
|
-
export const Route = 'observation';
|
|
6
|
-
export const UpperName = 'Observation';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface ICreateRequest {
|
|
10
|
-
owner_id: string;
|
|
11
|
-
observation_type_id?: string | null;
|
|
12
|
-
description: string;
|
|
13
|
-
internal: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface IUpdateRequest {
|
|
17
|
-
observation_type_id?: string | null;
|
|
18
|
-
description?: string;
|
|
19
|
-
internal?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface IFindByQueryRequest {
|
|
23
|
-
owner_id?: string;
|
|
24
|
-
observation_type_id?: string;
|
|
25
|
-
description?: string;
|
|
26
|
-
internal?: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface IFindByOwnerRequest {
|
|
30
|
-
owner_id: string;
|
|
31
|
-
includeInternal?: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface IFindByOwnersRequest {
|
|
35
|
-
owner_ids: string[];
|
|
36
|
-
includeInternal?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface IFindByOwnerResponse extends Entity {
|
|
40
|
-
observation_type: ObservationType | null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface IRepository {
|
|
44
|
-
// test
|
|
45
|
-
findById(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
46
|
-
findByQuery(data: IFindByQueryRequest): Promise<Entity[]>;
|
|
47
|
-
|
|
48
|
-
// rest
|
|
49
|
-
findByOwnerId(params: IFindByOwnerRequest): Promise<IFindByOwnerResponse[]>;
|
|
50
|
-
findByOwnerIds(params: IFindByOwnersRequest): Promise<IFindByOwnerResponse[]>;
|
|
51
|
-
create(data: ICreateRequest): Promise<IFindByOwnerResponse>;
|
|
52
|
-
update(
|
|
53
|
-
selector: IShared.IFindByIdRequest,
|
|
54
|
-
data: IUpdateRequest,
|
|
55
|
-
): Promise<IFindByOwnerResponse | null>;
|
|
56
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
60
|
-
|
|
61
|
-
export type IApi = Omit<IRepository, 'findById' | 'findByQuery'>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import {
|
|
4
|
-
ICreateRequest,
|
|
5
|
-
IUpdateRequest,
|
|
6
|
-
IFindByOwnersRequest,
|
|
7
|
-
IFindByOwnerRequest,
|
|
8
|
-
} from './interfaces';
|
|
9
|
-
import * as IShared from '../../../shared/interface';
|
|
10
|
-
|
|
11
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
12
|
-
owner_id: joi.string().uuid().required(),
|
|
13
|
-
observation_type_id: joi.string().uuid().allow(null).optional(),
|
|
14
|
-
description: joi.string().required(),
|
|
15
|
-
internal: joi.boolean().default(false).optional(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
19
|
-
|
|
20
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
21
|
-
observation_type_id: joi.string().uuid().allow(null).optional(),
|
|
22
|
-
description: joi.string().optional(),
|
|
23
|
-
internal: joi.boolean().optional(),
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
27
|
-
|
|
28
|
-
const findByOwnersBodyKeys: IShared.IRouteRequest<IFindByOwnersRequest> = {
|
|
29
|
-
owner_ids: joi.array().items(joi.string().uuid().required()).required(),
|
|
30
|
-
includeInternal: joi.boolean().optional(),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const findByOwnersBody = joi.object().keys(findByOwnersBodyKeys).messages(messages);
|
|
34
|
-
|
|
35
|
-
const findByOwnerQueryKeys: IShared.IRouteRequest<IFindByOwnerRequest> = {
|
|
36
|
-
owner_id: joi.string().uuid().required(),
|
|
37
|
-
includeInternal: joi.boolean().optional(),
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const findByOwnerQuery = joi.object().keys(findByOwnerQueryKeys).messages(messages);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { ObservationType } from '../../../shared/entities/integration';
|
|
3
|
-
|
|
4
|
-
export type Entity = ObservationType;
|
|
5
|
-
export const Route = 'observationType';
|
|
6
|
-
export const UpperName = 'ObservationType';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface IFindByQueryRequest {
|
|
10
|
-
id?: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ICreateRequest {
|
|
15
|
-
name: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface IUpdateRequest {
|
|
19
|
-
name: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface IRepository {
|
|
23
|
-
// test
|
|
24
|
-
findById(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
25
|
-
findByQuery(data: IFindByQueryRequest): Promise<Entity[]>;
|
|
26
|
-
|
|
27
|
-
// rest
|
|
28
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
29
|
-
find(): Promise<ObservationType[]>;
|
|
30
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
31
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
32
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
36
|
-
|
|
37
|
-
export type IApi = Omit<IRepository, 'findById' | 'findByQuery'>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
|
|
4
|
-
import { ICreateRequest, IUpdateRequest } from './interfaces';
|
|
5
|
-
import * as IShared from '../../../shared/interface';
|
|
6
|
-
|
|
7
|
-
export const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
|
-
name: joi.string().required(),
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
12
|
-
|
|
13
|
-
export const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
14
|
-
name: joi.string().required(),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ProjectInfo } from '../../../shared/entities/integration';
|
|
2
|
-
|
|
3
|
-
export type Entity = ProjectInfo;
|
|
4
|
-
export const Route = 'project_info';
|
|
5
|
-
export const UpperName = 'ProjectInfo';
|
|
6
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
7
|
-
|
|
8
|
-
export const IProjectInfoTypeEnum: {
|
|
9
|
-
particular: 'particular';
|
|
10
|
-
professional: 'professional';
|
|
11
|
-
company: 'company';
|
|
12
|
-
} = {
|
|
13
|
-
particular: 'particular',
|
|
14
|
-
professional: 'professional',
|
|
15
|
-
company: 'company',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type IProjectInfoType = (typeof IProjectInfoTypeEnum)[keyof typeof IProjectInfoTypeEnum];
|
|
19
|
-
|
|
20
|
-
export const projectInfoTypes = Object.keys(IProjectInfoTypeEnum);
|
|
21
|
-
|
|
22
|
-
export type ISendEmail = Omit<Entity, 'created_at' | 'updated_at' | 'document_header_id' | 'id'>;
|
|
23
|
-
|
|
24
|
-
export interface IController {
|
|
25
|
-
sendEmail(data: ISendEmail): Promise<void>;
|
|
26
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import { ISendEmail } from './interfaces';
|
|
4
|
-
import * as IShared from '../../../shared/interface';
|
|
5
|
-
|
|
6
|
-
const senEmailBodyKeys: IShared.IRouteRequest<ISendEmail> = {
|
|
7
|
-
name: joi.string().required(),
|
|
8
|
-
description: joi.string().required(),
|
|
9
|
-
telephone: joi.string().required(),
|
|
10
|
-
type: joi.string().valid('particular', 'professional', 'company'),
|
|
11
|
-
email: joi
|
|
12
|
-
.string()
|
|
13
|
-
.trim(true)
|
|
14
|
-
.lowercase()
|
|
15
|
-
.email({ tlds: { allow: false } }),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const sendEmailBody = joi.object().keys(senEmailBodyKeys).messages(messages);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Settings } from '../../../shared/entities/integration';
|
|
3
|
-
|
|
4
|
-
export type Entity = Settings;
|
|
5
|
-
export const Route = 'settings';
|
|
6
|
-
export const UpperName = 'Settings';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface IFindByKeyRequest {
|
|
10
|
-
key: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ICreateRequest {
|
|
14
|
-
key: string;
|
|
15
|
-
value: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface IUpdateRequest {
|
|
19
|
-
key: string;
|
|
20
|
-
value: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface IRepository {
|
|
24
|
-
find(): Promise<Entity[]>;
|
|
25
|
-
findByKey(selector: IFindByKeyRequest): Promise<Entity | null>;
|
|
26
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
27
|
-
update(data: IUpdateRequest): Promise<Entity | null>;
|
|
28
|
-
deleteOne(selector: IShared.IFindByIdNumberRequest): Promise<Entity | null>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import { ICreateRequest, IUpdateRequest, IFindByKeyRequest } from './interfaces';
|
|
4
|
-
import * as IShared from '../../../shared/interface';
|
|
5
|
-
|
|
6
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
7
|
-
key: joi.string().required(),
|
|
8
|
-
value: joi.string().required(),
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
12
|
-
|
|
13
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
14
|
-
key: joi.string().required(),
|
|
15
|
-
value: joi.string().required(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
19
|
-
|
|
20
|
-
const findQueryKeys: IShared.IRouteRequest<IFindByKeyRequest> = {
|
|
21
|
-
key: joi.string().required(),
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const findQuery = joi.object().keys(findQueryKeys).messages(messages);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Npc } from '../../../shared/entities/print';
|
|
3
|
-
|
|
4
|
-
export type Entity = Npc;
|
|
5
|
-
export const Route = 'npc';
|
|
6
|
-
export const UpperName = 'Npc';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
export interface IPrintJobs {
|
|
9
|
-
id: string;
|
|
10
|
-
moloni_json?: unknown;
|
|
11
|
-
buffer?: unknown;
|
|
12
|
-
external_url?: string | null;
|
|
13
|
-
printer_id: string;
|
|
14
|
-
orientation: 'landscape' | 'portrait';
|
|
15
|
-
}
|
|
16
|
-
export interface IFindPrintJobsForComputerIdResponse {
|
|
17
|
-
computer_name?: string | null;
|
|
18
|
-
print_jobs: IPrintJobs[];
|
|
19
|
-
}
|
|
20
|
-
export interface IUpdateRequest {
|
|
21
|
-
name?: string;
|
|
22
|
-
secret?: string;
|
|
23
|
-
}
|
|
24
|
-
export interface IFindPrintJobsForComputerIdRequest {
|
|
25
|
-
computer_id: string;
|
|
26
|
-
}
|
|
27
|
-
export interface IRepository {
|
|
28
|
-
find: () => Promise<Entity[]>;
|
|
29
|
-
findPrintJobsForComputerId(
|
|
30
|
-
selector: IFindPrintJobsForComputerIdRequest,
|
|
31
|
-
): Promise<IFindPrintJobsForComputerIdResponse>;
|
|
32
|
-
update: (params: IShared.IFindByIdRequest, data: IUpdateRequest) => Promise<Entity | null>;
|
|
33
|
-
}
|
|
34
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { IUpdateRequest, IFindPrintJobsForComputerIdRequest } from './interfaces';
|
|
5
|
-
|
|
6
|
-
// update body validation
|
|
7
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
8
|
-
name: joi.string().optional().allow(null),
|
|
9
|
-
secret: joi.string().optional().allow(null),
|
|
10
|
-
};
|
|
11
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
12
|
-
|
|
13
|
-
// findPrintJobsForComputerId validation
|
|
14
|
-
const findPrintJobsForComputerIdRequestParamsKeys: IShared.IRouteRequest<IFindPrintJobsForComputerIdRequest> =
|
|
15
|
-
{
|
|
16
|
-
computer_id: joi.string().required(),
|
|
17
|
-
};
|
|
18
|
-
export const findPrintJobsForComputerIdRequestParams = joi
|
|
19
|
-
.object()
|
|
20
|
-
.keys(findPrintJobsForComputerIdRequestParamsKeys)
|
|
21
|
-
.messages(messages);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Printer } from '../../../shared/entities/print';
|
|
3
|
-
|
|
4
|
-
export type Entity = Printer;
|
|
5
|
-
export const Route = 'printer';
|
|
6
|
-
export const UpperName = 'Printer';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export type IFindDetailedResponse = Entity & {
|
|
10
|
-
npc: Pick<Entity, 'name'>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type IPrinterData = Omit<Printer, 'id' | 'npc_id' | 'created_at' | 'updated_at'>;
|
|
14
|
-
|
|
15
|
-
export type IUpdateRequest = Omit<Printer, 'connected' | 'device_os_name' | 'npc_id' | 'id'>;
|
|
16
|
-
|
|
17
|
-
export interface IGetOrSetPrintersResponse {
|
|
18
|
-
printers_a4: IPrinterData[];
|
|
19
|
-
printers_pos: IPrinterData[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type IPrinterA4 = Pick<Printer, 'device_os_name' | 'name'>;
|
|
23
|
-
export type IPrinterPos = Pick<Printer, 'device_os_name'>;
|
|
24
|
-
|
|
25
|
-
export interface IGetOrSetPrintersRequest {
|
|
26
|
-
computer_id: string;
|
|
27
|
-
printers_a4: IPrinterA4[];
|
|
28
|
-
printers_pos: IPrinterPos[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IUpdateManyRequest {
|
|
32
|
-
id: string;
|
|
33
|
-
name: string;
|
|
34
|
-
enable: boolean;
|
|
35
|
-
paper: boolean;
|
|
36
|
-
receipt: boolean;
|
|
37
|
-
sticker: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface IRepository {
|
|
41
|
-
find: () => Promise<IFindDetailedResponse[]>;
|
|
42
|
-
findByOwnerId: (selector: IShared.IFindByOwnerIdRequest) => Promise<Entity[]>;
|
|
43
|
-
update: (params: IShared.IFindByIdRequest, data: IUpdateRequest) => Promise<Entity | null>;
|
|
44
|
-
updateMany: (data: IUpdateManyRequest[]) => Promise<void>;
|
|
45
|
-
getOrSetPrinters: (data: IGetOrSetPrintersRequest) => Promise<IGetOrSetPrintersResponse>;
|
|
46
|
-
}
|
|
47
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import {
|
|
5
|
-
IUpdateRequest,
|
|
6
|
-
IGetOrSetPrintersRequest,
|
|
7
|
-
IUpdateManyRequest,
|
|
8
|
-
IPrinterA4,
|
|
9
|
-
IPrinterPos,
|
|
10
|
-
} from './interfaces';
|
|
11
|
-
|
|
12
|
-
// update body validation
|
|
13
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
14
|
-
name: joi.string().optional(),
|
|
15
|
-
enable: joi.boolean().optional(),
|
|
16
|
-
paper: joi.boolean().optional(),
|
|
17
|
-
receipt: joi.boolean().optional(),
|
|
18
|
-
sticker: joi.boolean().optional(),
|
|
19
|
-
normalWidth: joi.number().integer().positive().optional(),
|
|
20
|
-
condensedWidth: joi.number().integer().positive().optional(),
|
|
21
|
-
dotWidth: joi.number().integer().positive().optional(),
|
|
22
|
-
hasDrawer: joi.number().integer().valid(0, 1).optional(),
|
|
23
|
-
hasCutter: joi.number().integer().valid(0, 1).optional(),
|
|
24
|
-
lowDensity: joi.number().integer().valid(0, 1).optional(),
|
|
25
|
-
imagePrintMode: joi.number().integer().valid(0, 1).optional(),
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
29
|
-
|
|
30
|
-
// getOrSetPrinters body validation
|
|
31
|
-
const getOrSetPrintersBodyKeys: IShared.IRouteRequest<IGetOrSetPrintersRequest> = {
|
|
32
|
-
printers_a4: joi.array().items(
|
|
33
|
-
joi.object<IPrinterA4>({
|
|
34
|
-
device_os_name: joi.string().required(),
|
|
35
|
-
name: joi.string().required(),
|
|
36
|
-
}),
|
|
37
|
-
),
|
|
38
|
-
printers_pos: joi.array().items(
|
|
39
|
-
joi.object<IPrinterPos>({
|
|
40
|
-
device_os_name: joi.string().required(),
|
|
41
|
-
}),
|
|
42
|
-
),
|
|
43
|
-
computer_id: joi.string().required(),
|
|
44
|
-
};
|
|
45
|
-
export const getOrSetPrintersBody = joi.object().keys(getOrSetPrintersBodyKeys).messages(messages);
|
|
46
|
-
|
|
47
|
-
// updateMany body validation
|
|
48
|
-
const updateManyBodyKeys: IShared.IRouteRequest<IUpdateManyRequest> = {
|
|
49
|
-
id: joi.string().uuid().required(),
|
|
50
|
-
name: joi.string().optional(),
|
|
51
|
-
enable: joi.boolean().optional(),
|
|
52
|
-
paper: joi.boolean().optional(),
|
|
53
|
-
receipt: joi.boolean().optional(),
|
|
54
|
-
sticker: joi.boolean().optional(),
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const updateManyBody = joi
|
|
58
|
-
.array()
|
|
59
|
-
.items(joi.object().keys(updateManyBodyKeys))
|
|
60
|
-
.messages(messages);
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { ScheduledPrintJob } from '../../../shared/entities/print';
|
|
3
|
-
|
|
4
|
-
export type Entity = ScheduledPrintJob;
|
|
5
|
-
export const Route = 'schedule_print_job';
|
|
6
|
-
export const UpperName = 'SchedulePrintJob';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface ICreateSchedulePrintJobRequest {
|
|
10
|
-
printer_id: string;
|
|
11
|
-
copies: number;
|
|
12
|
-
sticker?: boolean;
|
|
13
|
-
external_document_id?: string | undefined;
|
|
14
|
-
external_url?: string | undefined;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ICreateManySchedulePrintJobRequest {
|
|
18
|
-
jobs: ICreateSchedulePrintJobRequest[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface IDispatchSchedulePrintJobRequest {
|
|
22
|
-
computer_id: string;
|
|
23
|
-
last_print_job_ids: string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface IDispatchSchedulePrintJobResponse {
|
|
27
|
-
npc_id: string;
|
|
28
|
-
secret?: string | null;
|
|
29
|
-
print_jobs: {
|
|
30
|
-
id: string;
|
|
31
|
-
moloni_json?: unknown;
|
|
32
|
-
buffer?: string | null;
|
|
33
|
-
external_url?: string | null;
|
|
34
|
-
device_id: string;
|
|
35
|
-
orientation: 'landscape' | 'portrait';
|
|
36
|
-
}[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface IRepository {
|
|
40
|
-
dispatchSchedulePrintJob: (
|
|
41
|
-
data: IDispatchSchedulePrintJobRequest,
|
|
42
|
-
) => Promise<IDispatchSchedulePrintJobResponse>;
|
|
43
|
-
findByOwner: (data: IShared.IFindByOwnerIdRequest) => Promise<Entity[]>;
|
|
44
|
-
create: (data: ICreateSchedulePrintJobRequest) => Promise<void>;
|
|
45
|
-
createMany: (data: ICreateManySchedulePrintJobRequest) => Promise<void>;
|
|
46
|
-
deleteOne: (params: IShared.IFindByIdRequest) => Promise<void>;
|
|
47
|
-
}
|
|
48
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import {
|
|
5
|
-
ICreateManySchedulePrintJobRequest,
|
|
6
|
-
ICreateSchedulePrintJobRequest,
|
|
7
|
-
IDispatchSchedulePrintJobRequest,
|
|
8
|
-
} from './interfaces';
|
|
9
|
-
|
|
10
|
-
const dispatchSchedulePrintJobBodyKeys: IShared.IRouteRequest<IDispatchSchedulePrintJobRequest> = {
|
|
11
|
-
last_print_job_ids: joi.array().items(joi.string().uuid().optional()).required(),
|
|
12
|
-
computer_id: joi.string().required(),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const dispatchSchedulePrintJobBody = joi
|
|
16
|
-
.object()
|
|
17
|
-
.keys(dispatchSchedulePrintJobBodyKeys)
|
|
18
|
-
.messages(messages);
|
|
19
|
-
|
|
20
|
-
const createSchedulePrintJobBodyKeys: IShared.IRouteRequest<ICreateSchedulePrintJobRequest> = {
|
|
21
|
-
external_document_id: joi.string().optional(),
|
|
22
|
-
printer_id: joi.string().uuid().required(),
|
|
23
|
-
sticker: joi.boolean().optional(),
|
|
24
|
-
external_url: joi.string().optional(),
|
|
25
|
-
copies: joi.number().integer().positive().required(),
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const createSchedulePrintJobBody = joi
|
|
29
|
-
.object()
|
|
30
|
-
.keys(createSchedulePrintJobBodyKeys)
|
|
31
|
-
.xor('external_document_id', 'multimedia_id', 'external_url')
|
|
32
|
-
.messages(messages);
|
|
33
|
-
|
|
34
|
-
export const createManySchedulePrintJobBody = joi
|
|
35
|
-
.object<ICreateManySchedulePrintJobRequest>()
|
|
36
|
-
.keys({
|
|
37
|
-
jobs: joi.array().items(createSchedulePrintJobBody).required(),
|
|
38
|
-
})
|
|
39
|
-
.messages(messages);
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type * as IShared from '../../../shared/interface';
|
|
2
|
-
import type * as Persona from '../../user/persona/interface';
|
|
3
|
-
import { Chat, File } from '../../../shared/entities/stock';
|
|
4
|
-
|
|
5
|
-
export type Entity = Chat;
|
|
6
|
-
export const Route = 'chat';
|
|
7
|
-
export const UpperName = 'Chat';
|
|
8
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
9
|
-
|
|
10
|
-
export const ChatTypeEnum: {
|
|
11
|
-
por_proposta: 'por_proposta';
|
|
12
|
-
global: 'global';
|
|
13
|
-
} = {
|
|
14
|
-
por_proposta: 'por_proposta',
|
|
15
|
-
global: 'global',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type IChatType = (typeof ChatTypeEnum)[keyof typeof ChatTypeEnum];
|
|
19
|
-
|
|
20
|
-
export const chatTypes = Object.keys(ChatTypeEnum);
|
|
21
|
-
|
|
22
|
-
export interface IChatBalloon {
|
|
23
|
-
chat?: Pick<Entity, 'message'> & {
|
|
24
|
-
id?: string;
|
|
25
|
-
read?: boolean;
|
|
26
|
-
};
|
|
27
|
-
file?: Pick<File, 'multimedia_id' | 'filename'> & {
|
|
28
|
-
id?: string;
|
|
29
|
-
read?: boolean;
|
|
30
|
-
};
|
|
31
|
-
created_at: Date;
|
|
32
|
-
created_by: string;
|
|
33
|
-
is_customer: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type IReport = Pick<
|
|
37
|
-
Entity,
|
|
38
|
-
'email_processed' | 'email_delivered' | 'email_opened' | 'email_clicked'
|
|
39
|
-
>;
|
|
40
|
-
|
|
41
|
-
export interface IPublicFindActiveByOwnerIdResponse {
|
|
42
|
-
persona?: Persona.IFindContactPersonaByOwnerId;
|
|
43
|
-
last_group_report?: IReport;
|
|
44
|
-
owner_id?: string;
|
|
45
|
-
chat: IChatBalloon[];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ICreateRequest {
|
|
49
|
-
owner_id: string;
|
|
50
|
-
document_header_id: string;
|
|
51
|
-
message: string;
|
|
52
|
-
username: string;
|
|
53
|
-
is_customer: boolean;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface IUpdateRequest {
|
|
57
|
-
document_header_id?: string;
|
|
58
|
-
message?: string;
|
|
59
|
-
email_processed?: boolean;
|
|
60
|
-
email_delivered?: boolean;
|
|
61
|
-
email_opened?: boolean;
|
|
62
|
-
email_clicked?: boolean;
|
|
63
|
-
whatsapp_sent?: boolean;
|
|
64
|
-
read?: boolean;
|
|
65
|
-
username?: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface IRepository {
|
|
69
|
-
findActiveByOwnerId(
|
|
70
|
-
params: IShared.IFindByOwnerIdRequest,
|
|
71
|
-
): Promise<IPublicFindActiveByOwnerIdResponse>;
|
|
72
|
-
|
|
73
|
-
resendLast(params: IShared.IFindByOwnerIdRequest): Promise<void>;
|
|
74
|
-
create(data: ICreateRequest): Promise<Chat>;
|
|
75
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
|
|
76
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
|
|
77
|
-
|
|
78
|
-
markAllAsRead(params: IShared.IFindByOwnerIdRequest): Promise<void>;
|
|
79
|
-
markAllAsUnread(params: IShared.IFindByOwnerIdRequest): Promise<void>;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,28 +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 './interfaces';
|
|
5
|
-
|
|
6
|
-
// create body validation
|
|
7
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
|
-
owner_id: joi.string().uuid().required(),
|
|
9
|
-
document_header_id: joi.string().uuid().allow(null).required(),
|
|
10
|
-
message: joi.string().required(),
|
|
11
|
-
username: joi.string().required(),
|
|
12
|
-
is_customer: joi.boolean().default(false).optional(),
|
|
13
|
-
};
|
|
14
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
15
|
-
|
|
16
|
-
// update body validation
|
|
17
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
18
|
-
document_header_id: joi.string().uuid().optional(),
|
|
19
|
-
message: joi.string().optional(),
|
|
20
|
-
email_processed: joi.boolean().optional(),
|
|
21
|
-
email_delivered: joi.boolean().optional(),
|
|
22
|
-
email_opened: joi.boolean().optional(),
|
|
23
|
-
email_clicked: joi.boolean().optional(),
|
|
24
|
-
whatsapp_sent: joi.boolean().optional(),
|
|
25
|
-
read: joi.boolean().optional(),
|
|
26
|
-
username: joi.string().optional(),
|
|
27
|
-
};
|
|
28
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|