@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,28 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Favorites } from '../../../shared/entities/user';
|
|
3
|
-
|
|
4
|
-
export type Entity = Favorites;
|
|
5
|
-
export const Route = 'favorites';
|
|
6
|
-
export const UpperName = 'Favorites';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface ICreateRequest {
|
|
10
|
-
url: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IDeleteRequest {
|
|
14
|
-
url: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface IFindOneRequest {
|
|
18
|
-
url: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface IRepository {
|
|
22
|
-
list(user_id: string): Promise<Entity[]>;
|
|
23
|
-
findByUrl(params: IFindOneRequest): Promise<boolean>;
|
|
24
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
25
|
-
deleteOne(params: IDeleteRequest): Promise<Entity | null>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
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 { IFindOneRequest, ICreateRequest, IDeleteRequest } from './interfaces';
|
|
5
|
-
|
|
6
|
-
export const findByUrlQueryKeys: IShared.IRouteRequest<IFindOneRequest> = {
|
|
7
|
-
url: joi.string().required(),
|
|
8
|
-
};
|
|
9
|
-
export const findByUrlQuery = joi.object().keys(findByUrlQueryKeys).messages(messages);
|
|
10
|
-
|
|
11
|
-
export const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
12
|
-
url: joi.string().required(),
|
|
13
|
-
};
|
|
14
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
15
|
-
|
|
16
|
-
const deleteByUrlQueryKeys: IShared.IRouteRequest<IDeleteRequest> = {
|
|
17
|
-
url: joi.string().required(),
|
|
18
|
-
};
|
|
19
|
-
export const deleteByUrlQuery = joi.object().keys(deleteByUrlQueryKeys).messages(messages);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { GroupPermissions } from '../../../shared/entities/user';
|
|
3
|
-
|
|
4
|
-
export type Entity = GroupPermissions;
|
|
5
|
-
export const Route = 'group_permissions';
|
|
6
|
-
export const UpperName = 'GroupPermissions';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface ICreateRequest {
|
|
10
|
-
code: string;
|
|
11
|
-
description: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface IUpdateRequest {
|
|
15
|
-
code: string;
|
|
16
|
-
description: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface IRepository {
|
|
20
|
-
findByCode(code: string): Promise<Entity | null>;
|
|
21
|
-
findById(selector: IShared.IFindByIdNumberRequest): Promise<Entity | null>;
|
|
22
|
-
changeEnable(selector: IShared.IFindByIdNumberRequest): Promise<boolean>;
|
|
23
|
-
|
|
24
|
-
find(): Promise<Entity[]>;
|
|
25
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
26
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
27
|
-
deleteOne(selector: IShared.IFindByIdNumberRequest): Promise<Entity | null>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
31
|
-
|
|
32
|
-
export type IApi = Omit<IRepository, 'findByCode' | 'findById' | 'changeEnable'>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { ICreateRequest } from './interface';
|
|
5
|
-
|
|
6
|
-
// create body validation
|
|
7
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
|
-
code: joi.string().required(),
|
|
9
|
-
description: joi.string().required(),
|
|
10
|
-
};
|
|
11
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Language } from '../../../shared/entities/user';
|
|
3
|
-
|
|
4
|
-
export type Entity = Language;
|
|
5
|
-
export const Route = 'language';
|
|
6
|
-
export const UpperName = 'Language';
|
|
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
|
-
export type IFindRequest = Record<string, unknown>;
|
|
15
|
-
|
|
16
|
-
// omit any unnecessary fields
|
|
17
|
-
export type IFindResponse = Omit<IFindDetailedResponse, ''>;
|
|
18
|
-
|
|
19
|
-
export interface IFindPaginatedRequest extends IFindRequest, IShared.IPaginationRequest {}
|
|
20
|
-
|
|
21
|
-
export type IFindWithPaginationResponse = IShared.IPaginationResponse<
|
|
22
|
-
Omit<IFindDetailedResponse, ''>
|
|
23
|
-
>;
|
|
24
|
-
|
|
25
|
-
export interface ICreateRequest {
|
|
26
|
-
// create fields
|
|
27
|
-
name: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface IUpdateRequest {
|
|
31
|
-
// updatable fields
|
|
32
|
-
name?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface IRepository {
|
|
36
|
-
findById(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse | null>;
|
|
37
|
-
|
|
38
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
39
|
-
find(selector: IFindRequest): Promise<IFindResponse[]>;
|
|
40
|
-
findPaginated(selector: IFindPaginatedRequest): Promise<IFindWithPaginationResponse>;
|
|
41
|
-
|
|
42
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
43
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
44
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
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 { 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().required(),
|
|
15
|
-
};
|
|
16
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
17
|
-
const findQueryKeys: IShared.IRouteRequest<IFindRequest> = {};
|
|
18
|
-
export const findQuery = joi.object().keys(findQueryKeys).messages(messages);
|
|
19
|
-
|
|
20
|
-
// find with pagination query validation
|
|
21
|
-
const findWithPaginationQueryKeys: IShared.IRouteRequest<IFindPaginatedRequest> = {
|
|
22
|
-
per_page: joi.number().integer().positive().default(10).optional(),
|
|
23
|
-
current_page: joi.number().integer().positive().default(1).optional(),
|
|
24
|
-
};
|
|
25
|
-
export const findWithPaginationQuery = joi
|
|
26
|
-
.object()
|
|
27
|
-
.keys(findWithPaginationQueryKeys)
|
|
28
|
-
.messages(messages);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { MaturityDates } from '../../../shared/entities/user';
|
|
3
|
-
|
|
4
|
-
export type Entity = MaturityDates;
|
|
5
|
-
export const Route = 'maturity_dates';
|
|
6
|
-
export const UpperName = 'MaturityDates';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface ICreateRequest {
|
|
10
|
-
maturity_date_id: number;
|
|
11
|
-
name: string;
|
|
12
|
-
days: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IUpdateRequest {
|
|
16
|
-
maturity_date_id?: number;
|
|
17
|
-
name?: string;
|
|
18
|
-
days?: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface IRepository {
|
|
22
|
-
findById(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
23
|
-
|
|
24
|
-
find(): Promise<Entity[]>;
|
|
25
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
26
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
27
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
28
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
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, IUpdateRequest } from './interfaces';
|
|
5
|
-
|
|
6
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
7
|
-
name: joi.string().required(),
|
|
8
|
-
maturity_date_id: joi.number().integer().required(),
|
|
9
|
-
days: joi.number().integer().required(),
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
13
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
14
|
-
name: joi.string(),
|
|
15
|
-
maturity_date_id: joi.number().integer(),
|
|
16
|
-
days: joi.number().integer(),
|
|
17
|
-
};
|
|
18
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
|
|
3
|
-
export const Route = 'password';
|
|
4
|
-
|
|
5
|
-
export interface IForgotPassword {
|
|
6
|
-
account: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface IResetPassword {
|
|
10
|
-
token: string;
|
|
11
|
-
password: string;
|
|
12
|
-
password_confirmation: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IRepository {
|
|
16
|
-
resetPassword(params: IResetPassword): Promise<void>;
|
|
17
|
-
|
|
18
|
-
forgotPassword(params: IForgotPassword): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { IForgotPassword, IResetPassword } from './interfaces';
|
|
5
|
-
// create body validation
|
|
6
|
-
const forgotBodyKeys: IShared.IRouteRequest<IForgotPassword> = {
|
|
7
|
-
account: joi
|
|
8
|
-
.string()
|
|
9
|
-
.email({ tlds: { allow: false } })
|
|
10
|
-
.required(),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const forgotBody = joi.object().keys(forgotBodyKeys).messages(messages);
|
|
14
|
-
|
|
15
|
-
// update body validation
|
|
16
|
-
const resetBodyKeys: IShared.IRouteRequest<IResetPassword> = {
|
|
17
|
-
token: joi.string().uuid().required(),
|
|
18
|
-
password: joi.string().required(),
|
|
19
|
-
password_confirmation: joi.string().valid(joi.ref('password')),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const resetBody = joi.object().keys(resetBodyKeys).messages(messages);
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { PaymentMethods } from '../../../shared/entities/user';
|
|
3
|
-
|
|
4
|
-
export type Entity = PaymentMethods;
|
|
5
|
-
export const Route = 'payment_methods';
|
|
6
|
-
export const UpperName = 'PaymentMethods';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export const PaymentMethodsSaftCodeEnum: {
|
|
10
|
-
CC: 'CC';
|
|
11
|
-
CD: 'CD';
|
|
12
|
-
CH: 'CH';
|
|
13
|
-
CI: 'CI';
|
|
14
|
-
CO: 'CO';
|
|
15
|
-
CS: 'CS';
|
|
16
|
-
DE: 'DE';
|
|
17
|
-
LC: 'LC';
|
|
18
|
-
MB: 'MB';
|
|
19
|
-
NU: 'NU';
|
|
20
|
-
OU: 'OU';
|
|
21
|
-
PR: 'PR';
|
|
22
|
-
TB: 'TB';
|
|
23
|
-
TR: 'TR';
|
|
24
|
-
} = {
|
|
25
|
-
CC: 'CC',
|
|
26
|
-
CD: 'CD',
|
|
27
|
-
CH: 'CH',
|
|
28
|
-
CI: 'CI',
|
|
29
|
-
CO: 'CO',
|
|
30
|
-
CS: 'CS',
|
|
31
|
-
DE: 'DE',
|
|
32
|
-
LC: 'LC',
|
|
33
|
-
MB: 'MB',
|
|
34
|
-
NU: 'NU',
|
|
35
|
-
OU: 'OU',
|
|
36
|
-
PR: 'PR',
|
|
37
|
-
TB: 'TB',
|
|
38
|
-
TR: 'TR',
|
|
39
|
-
};
|
|
40
|
-
export type IPaymentMethodsSaftCodeEnum =
|
|
41
|
-
(typeof PaymentMethodsSaftCodeEnum)[keyof typeof PaymentMethodsSaftCodeEnum];
|
|
42
|
-
|
|
43
|
-
export interface ICreateRequest {
|
|
44
|
-
payment_method_id?: number | null;
|
|
45
|
-
name: string;
|
|
46
|
-
is_numerary: boolean;
|
|
47
|
-
is_mb: boolean;
|
|
48
|
-
is_credit: boolean;
|
|
49
|
-
hidden: boolean | null;
|
|
50
|
-
saft_code: IPaymentMethodsSaftCodeEnum;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface IUpdateRequest {
|
|
54
|
-
payment_method_id?: number | null;
|
|
55
|
-
name?: string;
|
|
56
|
-
is_numerary?: boolean;
|
|
57
|
-
is_mb?: boolean;
|
|
58
|
-
is_credit?: boolean;
|
|
59
|
-
hidden?: boolean | null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface IRepository {
|
|
63
|
-
findById(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
64
|
-
|
|
65
|
-
find(): Promise<Entity[]>;
|
|
66
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
67
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
68
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
69
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { ICreateRequest, IUpdateRequest, PaymentMethodsSaftCodeEnum } from './interfaces';
|
|
5
|
-
|
|
6
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
7
|
-
name: joi.string().required(),
|
|
8
|
-
payment_method_id: joi.number().integer().allow(null).optional(),
|
|
9
|
-
is_numerary: joi.boolean().default(false).optional(),
|
|
10
|
-
is_mb: joi.boolean().default(false).optional(),
|
|
11
|
-
is_credit: joi.boolean().default(false).optional(),
|
|
12
|
-
hidden: joi.boolean().default(false).allow(null).optional(),
|
|
13
|
-
saft_code: joi
|
|
14
|
-
.string()
|
|
15
|
-
.required()
|
|
16
|
-
.valid(...Object.values(PaymentMethodsSaftCodeEnum)),
|
|
17
|
-
};
|
|
18
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
19
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
20
|
-
name: joi.string().optional(),
|
|
21
|
-
payment_method_id: joi.number().integer().allow(null).optional(),
|
|
22
|
-
is_numerary: joi.boolean().optional(),
|
|
23
|
-
is_mb: joi.boolean().optional(),
|
|
24
|
-
is_credit: joi.boolean().optional(),
|
|
25
|
-
hidden: joi.boolean().allow(null).optional(),
|
|
26
|
-
};
|
|
27
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as IShared from '../../../shared/interface';
|
|
2
|
-
import { Permissions } from '../../../shared/entities/user';
|
|
3
|
-
|
|
4
|
-
export type Entity = Permissions;
|
|
5
|
-
export const Route = 'permission';
|
|
6
|
-
export const UpperName = 'Permissions';
|
|
7
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
8
|
-
|
|
9
|
-
export interface ICreateRequest {
|
|
10
|
-
// create fields
|
|
11
|
-
code: string;
|
|
12
|
-
description: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IUpdateRequest {
|
|
16
|
-
// create fields
|
|
17
|
-
code: string;
|
|
18
|
-
description: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface IRepository {
|
|
22
|
-
findById(selector: IShared.IFindByIdNumberRequest): Promise<Entity | null>;
|
|
23
|
-
findByCode(code: string): Promise<Entity | null>;
|
|
24
|
-
changeEnable(selector: IShared.IFindByIdNumberRequest): Promise<boolean>;
|
|
25
|
-
|
|
26
|
-
find(): Promise<Entity[]>;
|
|
27
|
-
findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
|
|
28
|
-
create(data: ICreateRequest): Promise<Entity>;
|
|
29
|
-
deleteOne(selector: IShared.IFindByIdNumberRequest): Promise<Entity | null>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
33
|
-
|
|
34
|
-
export type IApi = Omit<IRepository, 'findById' | 'findByCode' | 'changeEnable'>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import { ICreateRequest } from './interface';
|
|
5
|
-
|
|
6
|
-
// create body validation
|
|
7
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
8
|
-
code: joi.string().required(),
|
|
9
|
-
description: joi.string().required(),
|
|
10
|
-
};
|
|
11
|
-
export const createBody = joi.object().keys(createBodyKeys).messages(messages);
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import type * as IShared from '../../../shared/interface';
|
|
2
|
-
import type { Persona, Country, ReasonForExemption } from '../../../shared/entities/user';
|
|
3
|
-
import type { IChatType } from '../../stock/chat/interfaces';
|
|
4
|
-
|
|
5
|
-
export type Entity = Persona;
|
|
6
|
-
export const Route = 'persona';
|
|
7
|
-
export const UpperName = 'Persona';
|
|
8
|
-
export const LowerName = UpperName[0].toLowerCase() + UpperName.substring(1);
|
|
9
|
-
|
|
10
|
-
export interface IEntityExtended extends Entity {
|
|
11
|
-
formatted_address: string;
|
|
12
|
-
country: Country | null;
|
|
13
|
-
reason_for_exemption: ReasonForExemption | null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface IFindByOwnerIdResponse extends IEntityExtended {
|
|
17
|
-
main: boolean;
|
|
18
|
-
contact: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ICreateRequest {
|
|
22
|
-
name: string | null;
|
|
23
|
-
nif: string | null;
|
|
24
|
-
street: string | null;
|
|
25
|
-
postal_code: string | null;
|
|
26
|
-
locality: string | null;
|
|
27
|
-
country_id: string | null;
|
|
28
|
-
telephone: string | null;
|
|
29
|
-
email: string | null;
|
|
30
|
-
observations: string | null;
|
|
31
|
-
provider_id: string | null;
|
|
32
|
-
client_id: string | null;
|
|
33
|
-
commissioner_id: string | null;
|
|
34
|
-
store_operator_id: string | null;
|
|
35
|
-
reason_for_exemption_id: string | null;
|
|
36
|
-
main?: boolean;
|
|
37
|
-
contact?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface IUpdateRequest {
|
|
41
|
-
name?: string | null;
|
|
42
|
-
nif?: string | null;
|
|
43
|
-
street?: string | null;
|
|
44
|
-
postal_code?: string | null;
|
|
45
|
-
locality?: string | null;
|
|
46
|
-
country_id?: string | null;
|
|
47
|
-
telephone?: string | null;
|
|
48
|
-
email?: string | null;
|
|
49
|
-
observations?: string | null;
|
|
50
|
-
reason_for_exemption_id?: string | null;
|
|
51
|
-
main?: boolean;
|
|
52
|
-
contact?: boolean;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface IBasicSearchRequest extends IShared.IPaginationRequest {
|
|
56
|
-
search_value: string | null;
|
|
57
|
-
inactive?: boolean;
|
|
58
|
-
types?: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface IBasicSearchResponse {
|
|
62
|
-
id: string;
|
|
63
|
-
name: string;
|
|
64
|
-
number: number;
|
|
65
|
-
updated_at: Date;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface IFindRequest {
|
|
69
|
-
search_value: string;
|
|
70
|
-
}
|
|
71
|
-
export interface IFindResponse {
|
|
72
|
-
persona_id: string;
|
|
73
|
-
persona_name: string;
|
|
74
|
-
persona_nif: string | null;
|
|
75
|
-
persona_street: string;
|
|
76
|
-
persona_postal_code: string;
|
|
77
|
-
persona_locality: string;
|
|
78
|
-
persona_country_id: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface IDeletePersonaRequest {
|
|
82
|
-
id: string;
|
|
83
|
-
new_main_persona_id?: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface IFindContactPersonaByOwnerId
|
|
87
|
-
extends Pick<Persona, 'id' | 'name' | 'email' | 'telephone'> {
|
|
88
|
-
chat_type: IChatType;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface IFindByEmailRequest {
|
|
92
|
-
email: string;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface IFindByEmailResponse {
|
|
96
|
-
persona_id: string;
|
|
97
|
-
persona_name: string;
|
|
98
|
-
persona_nif: string | null;
|
|
99
|
-
client?: {
|
|
100
|
-
id: string;
|
|
101
|
-
name: string;
|
|
102
|
-
chat_type: IChatType;
|
|
103
|
-
} | null;
|
|
104
|
-
provider?: {
|
|
105
|
-
id: string;
|
|
106
|
-
name: string;
|
|
107
|
-
chat_type: IChatType;
|
|
108
|
-
} | null;
|
|
109
|
-
commissioner?: {
|
|
110
|
-
id: string;
|
|
111
|
-
name: string;
|
|
112
|
-
chat_type: IChatType;
|
|
113
|
-
} | null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface IFindClientOrProviderRequest {
|
|
117
|
-
nif?: string | null;
|
|
118
|
-
email?: string | null;
|
|
119
|
-
telephone?: string | null;
|
|
120
|
-
user_type: 'client' | 'provider';
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface IFindClientOrProviderResponse {
|
|
124
|
-
client_id: string | null;
|
|
125
|
-
provider_id: string | null;
|
|
126
|
-
nif: string | null;
|
|
127
|
-
name: string | null;
|
|
128
|
-
email: string | null;
|
|
129
|
-
telephone: string | null;
|
|
130
|
-
}
|
|
131
|
-
export interface IRepository {
|
|
132
|
-
findById(selector: IShared.IFindByIdRequest): Promise<IEntityExtended | null>;
|
|
133
|
-
|
|
134
|
-
findByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
|
|
135
|
-
|
|
136
|
-
findContactPersonaByOwnerId(
|
|
137
|
-
params: IShared.IFindByOwnerIdRequest,
|
|
138
|
-
): Promise<IFindContactPersonaByOwnerId>;
|
|
139
|
-
|
|
140
|
-
create(data: ICreateRequest): Promise<IEntityExtended>;
|
|
141
|
-
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<IEntityExtended | null>;
|
|
142
|
-
deleteOne(params: IDeletePersonaRequest): Promise<IEntityExtended | null>;
|
|
143
|
-
|
|
144
|
-
findByBasic(
|
|
145
|
-
data: IBasicSearchRequest,
|
|
146
|
-
): Promise<IShared.IPaginationResponse<IBasicSearchResponse>>;
|
|
147
|
-
|
|
148
|
-
find(data: IFindRequest): Promise<IFindResponse[]>;
|
|
149
|
-
|
|
150
|
-
findByEmail(data: IFindByEmailRequest): Promise<IFindByEmailResponse[]>;
|
|
151
|
-
|
|
152
|
-
findClientOrProvider(
|
|
153
|
-
data: IFindClientOrProviderRequest,
|
|
154
|
-
): Promise<IFindClientOrProviderResponse[]>;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import joi from 'joi';
|
|
2
|
-
import { messages } from '../../../shared/messages';
|
|
3
|
-
import * as IShared from '../../../shared/interface';
|
|
4
|
-
import {
|
|
5
|
-
IBasicSearchRequest,
|
|
6
|
-
ICreateRequest,
|
|
7
|
-
IDeletePersonaRequest,
|
|
8
|
-
IFindByEmailRequest,
|
|
9
|
-
IFindRequest,
|
|
10
|
-
IUpdateRequest,
|
|
11
|
-
IFindClientOrProviderRequest,
|
|
12
|
-
} from './interface';
|
|
13
|
-
|
|
14
|
-
const emailSchema = joi
|
|
15
|
-
.string()
|
|
16
|
-
.trim(true)
|
|
17
|
-
.lowercase()
|
|
18
|
-
.email({ tlds: { allow: false } })
|
|
19
|
-
.allow(null, '');
|
|
20
|
-
|
|
21
|
-
// create body validation
|
|
22
|
-
const createBodyKeys: IShared.IRouteRequest<ICreateRequest> = {
|
|
23
|
-
name: joi.string().allow(null, '').optional(),
|
|
24
|
-
nif: joi.string().allow(null, '').optional(),
|
|
25
|
-
street: joi.string().allow(null, '').optional(),
|
|
26
|
-
locality: joi.string().allow(null, '').optional(),
|
|
27
|
-
postal_code: joi.string().trim(true).lowercase().allow(null, '').optional(),
|
|
28
|
-
country_id: joi.string().uuid().allow(null, '').optional(),
|
|
29
|
-
telephone: joi.string().allow(null, '').optional(),
|
|
30
|
-
email: emailSchema.optional(),
|
|
31
|
-
observations: joi.string().allow(null, '').optional(),
|
|
32
|
-
provider_id: joi.string().uuid().allow(null, ''),
|
|
33
|
-
client_id: joi.string().uuid().allow(null, ''),
|
|
34
|
-
commissioner_id: joi.string().uuid().allow(null, ''),
|
|
35
|
-
store_operator_id: joi.string().uuid().allow(null, ''),
|
|
36
|
-
reason_for_exemption_id: joi.string().uuid().allow(null, '').optional(),
|
|
37
|
-
main: joi.boolean().default(false).optional(),
|
|
38
|
-
contact: joi.boolean().default(false).optional(),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const createBody = joi
|
|
42
|
-
.object()
|
|
43
|
-
.keys(createBodyKeys)
|
|
44
|
-
.xor('provider_id', 'client_id', 'commissioner_id')
|
|
45
|
-
.messages(messages);
|
|
46
|
-
|
|
47
|
-
// update body validation
|
|
48
|
-
const updateBodyKeys: IShared.IRouteRequest<IUpdateRequest> = {
|
|
49
|
-
name: joi.string().allow(null, '').optional(),
|
|
50
|
-
nif: joi.string().allow(null, '').optional(),
|
|
51
|
-
street: joi.string().allow(null, '').optional(),
|
|
52
|
-
locality: joi.string().allow(null, '').optional(),
|
|
53
|
-
postal_code: joi.string().trim(true).lowercase().allow(null, '').optional(),
|
|
54
|
-
country_id: joi.string().uuid().allow(null, '').optional(),
|
|
55
|
-
telephone: joi.string().allow(null, '').optional(),
|
|
56
|
-
email: emailSchema.optional(),
|
|
57
|
-
observations: joi.string().allow(null, '').optional(),
|
|
58
|
-
reason_for_exemption_id: joi.string().uuid().allow(null, '').optional(),
|
|
59
|
-
main: joi.boolean().optional(),
|
|
60
|
-
contact: joi.boolean().optional(),
|
|
61
|
-
};
|
|
62
|
-
export const updateBody = joi.object().keys(updateBodyKeys).messages(messages);
|
|
63
|
-
|
|
64
|
-
const findQueryKeys: IShared.IRouteRequest<IFindRequest> = {
|
|
65
|
-
search_value: joi.string().allow('', null).optional(),
|
|
66
|
-
};
|
|
67
|
-
export const findQuery = joi.object().keys(findQueryKeys).messages(messages);
|
|
68
|
-
|
|
69
|
-
const getBasicSearchQueryKeys: IShared.IRouteRequest<IBasicSearchRequest> = {
|
|
70
|
-
per_page: joi.number().integer().positive().default(10).optional(),
|
|
71
|
-
current_page: joi.number().integer().positive().default(1).optional(),
|
|
72
|
-
inactive: joi.boolean().default(false).optional(),
|
|
73
|
-
search_value: joi.string().allow('', null).optional(),
|
|
74
|
-
types: joi.string().allow('', null).optional(),
|
|
75
|
-
};
|
|
76
|
-
export const getBasicSearchParamsValidate = joi
|
|
77
|
-
.object()
|
|
78
|
-
.keys(getBasicSearchQueryKeys)
|
|
79
|
-
.messages(messages);
|
|
80
|
-
|
|
81
|
-
const deleteQueryKeys: IShared.IRouteRequest<IDeletePersonaRequest> = {
|
|
82
|
-
id: joi.string().uuid().required(),
|
|
83
|
-
new_main_persona_id: joi.string().uuid().optional(),
|
|
84
|
-
};
|
|
85
|
-
export const deleteQueryValidate = joi.object().keys(deleteQueryKeys).messages(messages);
|
|
86
|
-
|
|
87
|
-
const findByEmailQueryKeys: IShared.IRouteRequest<IFindByEmailRequest> = {
|
|
88
|
-
email: emailSchema,
|
|
89
|
-
};
|
|
90
|
-
export const FindByEmailQueryValidate = joi.object().keys(findByEmailQueryKeys).messages(messages);
|
|
91
|
-
|
|
92
|
-
const findClientOrProviderQueryKeys: IShared.IRouteRequest<IFindClientOrProviderRequest> = {
|
|
93
|
-
nif: joi.string().allow('', null).optional(),
|
|
94
|
-
email: emailSchema.optional(),
|
|
95
|
-
telephone: joi.string().allow('', null).optional(),
|
|
96
|
-
user_type: joi.string().valid('client', 'provider').optional(),
|
|
97
|
-
};
|
|
98
|
-
export const FindClientOrProviderQueryValidate = joi
|
|
99
|
-
.object()
|
|
100
|
-
.keys(findClientOrProviderQueryKeys)
|
|
101
|
-
.messages(messages);
|