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