@nomalism-com/types 0.45.57 → 0.45.59
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
CHANGED
|
@@ -5805,15 +5805,15 @@ var printLocationsQuery = joi118.object({
|
|
|
5805
5805
|
// src/modules/user/timeSheet/interfaces.ts
|
|
5806
5806
|
var interfaces_exports61 = {};
|
|
5807
5807
|
__export(interfaces_exports61, {
|
|
5808
|
-
ClockRoute: () => ClockRoute,
|
|
5809
|
-
DayRoute: () => DayRoute,
|
|
5810
5808
|
IClockTypeEnum: () => IClockTypeEnum,
|
|
5811
5809
|
IRegistryTypeEnum: () => IRegistryTypeEnum,
|
|
5812
5810
|
ITimesheetStateEnum: () => ITimesheetStateEnum,
|
|
5811
|
+
Route: () => Route130,
|
|
5813
5812
|
clockTypes: () => clockTypes,
|
|
5814
5813
|
registryTypes: () => registryTypes,
|
|
5815
5814
|
timesheetStates: () => timesheetStates
|
|
5816
5815
|
});
|
|
5816
|
+
var Route130 = "time_sheet";
|
|
5817
5817
|
var IClockTypeEnum = {
|
|
5818
5818
|
ENTRY: "ENTRY",
|
|
5819
5819
|
EXIT: "EXIT"
|
|
@@ -5830,45 +5830,43 @@ var ITimesheetStateEnum = {
|
|
|
5830
5830
|
ERROR: "ERROR"
|
|
5831
5831
|
};
|
|
5832
5832
|
var timesheetStates = Object.keys(ITimesheetStateEnum);
|
|
5833
|
-
var DayRoute = "timesheet-days";
|
|
5834
|
-
var ClockRoute = "timesheet-clocks";
|
|
5835
5833
|
|
|
5836
5834
|
// src/modules/user/timeSheet/route.schema.ts
|
|
5837
5835
|
var route_schema_exports118 = {};
|
|
5838
5836
|
__export(route_schema_exports118, {
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
updateClockBody: () => updateClockBody,
|
|
5842
|
-
updateDayBody: () => updateDayBody
|
|
5837
|
+
createBody: () => createBody65,
|
|
5838
|
+
updateBody: () => updateBody56
|
|
5843
5839
|
});
|
|
5844
5840
|
import joi119 from "joi";
|
|
5845
|
-
var
|
|
5841
|
+
var clockSchema = joi119.object({
|
|
5842
|
+
id: joi119.string().uuid(),
|
|
5843
|
+
// Opcional no create/update (indica se já existe ou é novo)
|
|
5844
|
+
time: joi119.date().required(),
|
|
5845
|
+
type: joi119.string().valid(...Object.values(IClockTypeEnum)).required(),
|
|
5846
|
+
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum)).required()
|
|
5847
|
+
});
|
|
5848
|
+
var createBodyKeys64 = {
|
|
5846
5849
|
date: joi119.date().required(),
|
|
5847
5850
|
persona_id: joi119.string().uuid().required(),
|
|
5848
5851
|
total_worked: joi119.number().integer().min(0),
|
|
5849
5852
|
balance: joi119.number().integer(),
|
|
5850
|
-
state: joi119.string().valid(...Object.values(ITimesheetStateEnum))
|
|
5853
|
+
state: joi119.string().valid(...Object.values(ITimesheetStateEnum)),
|
|
5854
|
+
// Objeto opcional para quando se cria o dia já com a primeira picagem (ex: via telemóvel)
|
|
5855
|
+
clock: joi119.object({
|
|
5856
|
+
time: joi119.date(),
|
|
5857
|
+
type: joi119.string().valid(...Object.values(IClockTypeEnum)).required(),
|
|
5858
|
+
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum)).required()
|
|
5859
|
+
})
|
|
5851
5860
|
};
|
|
5852
|
-
var
|
|
5853
|
-
var
|
|
5861
|
+
var createBody65 = joi119.object().keys(createBodyKeys64).messages(messages);
|
|
5862
|
+
var updateBodyKeys54 = {
|
|
5854
5863
|
total_worked: joi119.number().integer().min(0),
|
|
5855
5864
|
balance: joi119.number().integer(),
|
|
5856
|
-
state: joi119.string().valid(...Object.values(ITimesheetStateEnum))
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
var createClockBodyKeys = {
|
|
5860
|
-
timesheet_day_id: joi119.string().uuid().required(),
|
|
5861
|
-
time: joi119.date(),
|
|
5862
|
-
type: joi119.string().valid(...Object.values(IClockTypeEnum)).required(),
|
|
5863
|
-
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum)).required()
|
|
5864
|
-
};
|
|
5865
|
-
var createClockBody = joi119.object().keys(createClockBodyKeys).messages(messages);
|
|
5866
|
-
var updateClockBodyKeys = {
|
|
5867
|
-
time: joi119.date(),
|
|
5868
|
-
type: joi119.string().valid(...Object.values(IClockTypeEnum)),
|
|
5869
|
-
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum))
|
|
5865
|
+
state: joi119.string().valid(...Object.values(ITimesheetStateEnum)),
|
|
5866
|
+
// Array de picagens enviado pelo formulário de edição (Modais do teu Mockup)
|
|
5867
|
+
clocks: joi119.array().items(clockSchema)
|
|
5870
5868
|
};
|
|
5871
|
-
var
|
|
5869
|
+
var updateBody56 = joi119.object().keys(updateBodyKeys54).messages(messages);
|
|
5872
5870
|
|
|
5873
5871
|
// src/index.ts
|
|
5874
5872
|
var index_default = main_exports;
|
package/dist/index.js
CHANGED
|
@@ -5805,15 +5805,15 @@ var printLocationsQuery = joi118.object({
|
|
|
5805
5805
|
// src/modules/user/timeSheet/interfaces.ts
|
|
5806
5806
|
var interfaces_exports61 = {};
|
|
5807
5807
|
__export(interfaces_exports61, {
|
|
5808
|
-
ClockRoute: () => ClockRoute,
|
|
5809
|
-
DayRoute: () => DayRoute,
|
|
5810
5808
|
IClockTypeEnum: () => IClockTypeEnum,
|
|
5811
5809
|
IRegistryTypeEnum: () => IRegistryTypeEnum,
|
|
5812
5810
|
ITimesheetStateEnum: () => ITimesheetStateEnum,
|
|
5811
|
+
Route: () => Route130,
|
|
5813
5812
|
clockTypes: () => clockTypes,
|
|
5814
5813
|
registryTypes: () => registryTypes,
|
|
5815
5814
|
timesheetStates: () => timesheetStates
|
|
5816
5815
|
});
|
|
5816
|
+
var Route130 = "time_sheet";
|
|
5817
5817
|
var IClockTypeEnum = {
|
|
5818
5818
|
ENTRY: "ENTRY",
|
|
5819
5819
|
EXIT: "EXIT"
|
|
@@ -5830,45 +5830,43 @@ var ITimesheetStateEnum = {
|
|
|
5830
5830
|
ERROR: "ERROR"
|
|
5831
5831
|
};
|
|
5832
5832
|
var timesheetStates = Object.keys(ITimesheetStateEnum);
|
|
5833
|
-
var DayRoute = "timesheet-days";
|
|
5834
|
-
var ClockRoute = "timesheet-clocks";
|
|
5835
5833
|
|
|
5836
5834
|
// src/modules/user/timeSheet/route.schema.ts
|
|
5837
5835
|
var route_schema_exports118 = {};
|
|
5838
5836
|
__export(route_schema_exports118, {
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
updateClockBody: () => updateClockBody,
|
|
5842
|
-
updateDayBody: () => updateDayBody
|
|
5837
|
+
createBody: () => createBody65,
|
|
5838
|
+
updateBody: () => updateBody56
|
|
5843
5839
|
});
|
|
5844
5840
|
import joi119 from "joi";
|
|
5845
|
-
var
|
|
5841
|
+
var clockSchema = joi119.object({
|
|
5842
|
+
id: joi119.string().uuid(),
|
|
5843
|
+
// Opcional no create/update (indica se já existe ou é novo)
|
|
5844
|
+
time: joi119.date().required(),
|
|
5845
|
+
type: joi119.string().valid(...Object.values(IClockTypeEnum)).required(),
|
|
5846
|
+
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum)).required()
|
|
5847
|
+
});
|
|
5848
|
+
var createBodyKeys64 = {
|
|
5846
5849
|
date: joi119.date().required(),
|
|
5847
5850
|
persona_id: joi119.string().uuid().required(),
|
|
5848
5851
|
total_worked: joi119.number().integer().min(0),
|
|
5849
5852
|
balance: joi119.number().integer(),
|
|
5850
|
-
state: joi119.string().valid(...Object.values(ITimesheetStateEnum))
|
|
5853
|
+
state: joi119.string().valid(...Object.values(ITimesheetStateEnum)),
|
|
5854
|
+
// Objeto opcional para quando se cria o dia já com a primeira picagem (ex: via telemóvel)
|
|
5855
|
+
clock: joi119.object({
|
|
5856
|
+
time: joi119.date(),
|
|
5857
|
+
type: joi119.string().valid(...Object.values(IClockTypeEnum)).required(),
|
|
5858
|
+
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum)).required()
|
|
5859
|
+
})
|
|
5851
5860
|
};
|
|
5852
|
-
var
|
|
5853
|
-
var
|
|
5861
|
+
var createBody65 = joi119.object().keys(createBodyKeys64).messages(messages);
|
|
5862
|
+
var updateBodyKeys54 = {
|
|
5854
5863
|
total_worked: joi119.number().integer().min(0),
|
|
5855
5864
|
balance: joi119.number().integer(),
|
|
5856
|
-
state: joi119.string().valid(...Object.values(ITimesheetStateEnum))
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
var createClockBodyKeys = {
|
|
5860
|
-
timesheet_day_id: joi119.string().uuid().required(),
|
|
5861
|
-
time: joi119.date(),
|
|
5862
|
-
type: joi119.string().valid(...Object.values(IClockTypeEnum)).required(),
|
|
5863
|
-
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum)).required()
|
|
5864
|
-
};
|
|
5865
|
-
var createClockBody = joi119.object().keys(createClockBodyKeys).messages(messages);
|
|
5866
|
-
var updateClockBodyKeys = {
|
|
5867
|
-
time: joi119.date(),
|
|
5868
|
-
type: joi119.string().valid(...Object.values(IClockTypeEnum)),
|
|
5869
|
-
registry_type: joi119.string().valid(...Object.values(IRegistryTypeEnum))
|
|
5865
|
+
state: joi119.string().valid(...Object.values(ITimesheetStateEnum)),
|
|
5866
|
+
// Array de picagens enviado pelo formulário de edição (Modais do teu Mockup)
|
|
5867
|
+
clocks: joi119.array().items(clockSchema)
|
|
5870
5868
|
};
|
|
5871
|
-
var
|
|
5869
|
+
var updateBody56 = joi119.object().keys(updateBodyKeys54).messages(messages);
|
|
5872
5870
|
|
|
5873
5871
|
// src/index.ts
|
|
5874
5872
|
var index_default = main_exports;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as IShared from '../../../shared/interface';
|
|
2
2
|
import { TimeSheetDay, TimeSheetClock } from '../../../shared/entities/user';
|
|
3
|
+
export type Entity = TimeSheetDay & {
|
|
4
|
+
clocks: TimeSheetClock[];
|
|
5
|
+
};
|
|
6
|
+
export declare const Route = "time_sheet";
|
|
3
7
|
export declare const IClockTypeEnum: {
|
|
4
8
|
ENTRY: 'ENTRY';
|
|
5
9
|
EXIT: 'EXIT';
|
|
@@ -19,56 +23,41 @@ export declare const ITimesheetStateEnum: {
|
|
|
19
23
|
};
|
|
20
24
|
export type ITimesheetState = (typeof ITimesheetStateEnum)[keyof typeof ITimesheetStateEnum];
|
|
21
25
|
export declare const timesheetStates: string[];
|
|
22
|
-
export
|
|
23
|
-
export type ClockEntity = TimeSheetClock;
|
|
24
|
-
export declare const DayRoute = "timesheet-days";
|
|
25
|
-
export declare const ClockRoute = "timesheet-clocks";
|
|
26
|
-
export interface IDayFilterRequest {
|
|
26
|
+
export interface IFindRequest {
|
|
27
27
|
persona_id?: string;
|
|
28
28
|
start_date?: string;
|
|
29
29
|
end_date?: string;
|
|
30
30
|
state?: ITimesheetState;
|
|
31
31
|
}
|
|
32
|
-
export interface
|
|
32
|
+
export interface ICreateRequest {
|
|
33
33
|
date: Date;
|
|
34
34
|
persona_id: string;
|
|
35
35
|
total_worked?: number;
|
|
36
36
|
balance?: number;
|
|
37
37
|
state?: ITimesheetState;
|
|
38
|
+
clock?: {
|
|
39
|
+
time?: Date;
|
|
40
|
+
type: IClockType;
|
|
41
|
+
registry_type: IRegistryType;
|
|
42
|
+
};
|
|
38
43
|
}
|
|
39
|
-
export interface
|
|
44
|
+
export interface IUpdateRequest {
|
|
40
45
|
total_worked?: number;
|
|
41
46
|
balance?: number;
|
|
42
47
|
state?: ITimesheetState;
|
|
48
|
+
clocks?: {
|
|
49
|
+
id?: string;
|
|
50
|
+
time: Date;
|
|
51
|
+
type: IClockType;
|
|
52
|
+
registry_type: IRegistryType;
|
|
53
|
+
}[];
|
|
43
54
|
}
|
|
44
|
-
export interface
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export interface IClockUpdateRequest {
|
|
51
|
-
time?: Date;
|
|
52
|
-
type?: IClockType;
|
|
53
|
-
registry_type?: IRegistryType;
|
|
54
|
-
}
|
|
55
|
-
export interface IDayRepository {
|
|
56
|
-
find(filters?: IDayFilterRequest): Promise<DayEntity[]>;
|
|
57
|
-
findById(id: string): Promise<DayEntity | null>;
|
|
58
|
-
create(data: IDayCreateRequest): Promise<DayEntity>;
|
|
59
|
-
update(selector: IShared.IFindByIdRequest, data: IDayUpdateRequest): Promise<DayEntity | null>;
|
|
60
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<DayEntity | null>;
|
|
61
|
-
}
|
|
62
|
-
export interface IClockRepository {
|
|
63
|
-
find(filters?: {
|
|
64
|
-
timesheet_day_id: string;
|
|
65
|
-
}): Promise<ClockEntity[]>;
|
|
66
|
-
findById(id: string): Promise<ClockEntity | null>;
|
|
67
|
-
create(data: IClockCreateRequest): Promise<ClockEntity>;
|
|
68
|
-
update(selector: IShared.IFindByIdRequest, data: IClockUpdateRequest): Promise<ClockEntity | null>;
|
|
69
|
-
deleteOne(selector: IShared.IFindByIdRequest): Promise<ClockEntity | null>;
|
|
55
|
+
export interface IRepository {
|
|
56
|
+
find(filters?: IFindRequest): Promise<Entity[]>;
|
|
57
|
+
findById(id: string): Promise<Entity | null>;
|
|
58
|
+
create(data: ICreateRequest): Promise<Entity>;
|
|
59
|
+
update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
|
|
60
|
+
deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
|
|
70
61
|
}
|
|
71
|
-
export type
|
|
72
|
-
export type
|
|
73
|
-
export type IClockController = IShared.IEntityWithUserToken<IClockRepository>;
|
|
74
|
-
export type IClockApi = Omit<IClockRepository, 'findById'>;
|
|
62
|
+
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
63
|
+
export type IApi = Omit<IRepository, 'findById'>;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import joi from 'joi';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const createClockBody: joi.ObjectSchema<any>;
|
|
5
|
-
export declare const updateClockBody: joi.ObjectSchema<any>;
|
|
2
|
+
export declare const createBody: joi.ObjectSchema<any>;
|
|
3
|
+
export declare const updateBody: joi.ObjectSchema<any>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomalism-com/types",
|
|
3
3
|
"description": "A nomalism package with all necessary types and validations for developing APIs",
|
|
4
|
-
"version": "0.45.
|
|
4
|
+
"version": "0.45.59",
|
|
5
5
|
"author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|