@managemint-solutions/entities 1.22.1 → 1.23.1

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.
@@ -18,6 +18,7 @@ export declare enum AuditTrailEntityType {
18
18
  PROJECTS = "projects",
19
19
  TASKS = "tasks",
20
20
  TIMESHEETS = "timesheets",
21
+ TIMESHEET_ENTRIES = "timesheet_entries",
21
22
  LEAVE_TYPES = "leave_types",
22
23
  LEAVE_ENTITLEMENTS = "leave_entitlements",
23
24
  LEAVE_REQUESTS = "leave_requests",
@@ -23,6 +23,7 @@ var AuditTrailEntityType;
23
23
  AuditTrailEntityType["PROJECTS"] = "projects";
24
24
  AuditTrailEntityType["TASKS"] = "tasks";
25
25
  AuditTrailEntityType["TIMESHEETS"] = "timesheets";
26
+ AuditTrailEntityType["TIMESHEET_ENTRIES"] = "timesheet_entries";
26
27
  AuditTrailEntityType["LEAVE_TYPES"] = "leave_types";
27
28
  AuditTrailEntityType["LEAVE_ENTITLEMENTS"] = "leave_entitlements";
28
29
  AuditTrailEntityType["LEAVE_REQUESTS"] = "leave_requests";
@@ -20,6 +20,7 @@ export type CreateLeaveTypeDto = {
20
20
  default_days: number;
21
21
  is_paid: boolean;
22
22
  requires_approval: boolean;
23
+ requires_document: boolean;
23
24
  };
24
25
  export type UpdateLeaveTypeDto = {
25
26
  name: string;
@@ -27,6 +28,7 @@ export type UpdateLeaveTypeDto = {
27
28
  default_days: number;
28
29
  is_paid: boolean;
29
30
  requires_approval: boolean;
31
+ requires_document: boolean;
30
32
  active: boolean;
31
33
  };
32
34
  export type LeaveEntitlementIdDto = {
@@ -48,11 +50,13 @@ export type CreateLeaveEntitlementDto = {
48
50
  period_start: string | null;
49
51
  /** Null = one year after `period_start`, less a day. */
50
52
  period_end: string | null;
53
+ max_carry_over_days: number;
51
54
  notes: string | null;
52
55
  };
53
56
  export type UpdateLeaveEntitlementDto = {
54
57
  days_entitled: number;
55
58
  period_end: string;
59
+ max_carry_over_days: number;
56
60
  notes: string | null;
57
61
  };
58
62
  export type LeaveRequestIdDto = {
@@ -10,6 +10,8 @@ export * from './enum';
10
10
  export type LeaveTypeIdentity = {
11
11
  mms_id: string;
12
12
  name: string;
13
+ /** Carried on requests and entitlements so a reviewer knows without a second fetch. */
14
+ requires_document: boolean;
13
15
  };
14
16
  export type LeaveTypeEntity = {
15
17
  mms_id: string;
@@ -24,6 +26,8 @@ export type LeaveTypeEntity = {
24
26
  is_paid: boolean;
25
27
  /** False auto-approves a request on submission. */
26
28
  requires_approval: boolean;
29
+ /** Approval waits until a supporting file is attached to the request; implies `requires_approval`. */
30
+ requires_document: boolean;
27
31
  /** An inactive type keeps its history but cannot be chosen for new requests. */
28
32
  active: boolean;
29
33
  };
@@ -41,6 +45,8 @@ export type LeaveEntitlementEntity = LeavePeriod & {
41
45
  user: UserIdentity;
42
46
  leave_type: LeaveTypeIdentity;
43
47
  days_entitled: number;
48
+ /** Cap on the unused days the nightly rollover carries into the next period. */
49
+ max_carry_over_days: number;
44
50
  notes: string | null;
45
51
  /**
46
52
  * Computed on read, never stored: the approved and pending requests of this user and
@@ -16,6 +16,9 @@ export declare enum NotificationType {
16
16
  LEAVE_REQUEST_SUBMITTED = "leave_request_submitted",
17
17
  LEAVE_REQUEST_APPROVED = "leave_request_approved",
18
18
  LEAVE_REQUEST_REJECTED = "leave_request_rejected",
19
+ TIMESHEET_SUBMITTED = "timesheet_submitted",
20
+ TIMESHEET_APPROVED = "timesheet_approved",
21
+ TIMESHEET_REJECTED = "timesheet_rejected",
19
22
  SIGNUP_CONFIRMATION = "signup_confirmation",
20
23
  PASSWORD_RECOVERY = "password_recovery"
21
24
  }
@@ -24,6 +24,9 @@ var NotificationType;
24
24
  NotificationType["LEAVE_REQUEST_SUBMITTED"] = "leave_request_submitted";
25
25
  NotificationType["LEAVE_REQUEST_APPROVED"] = "leave_request_approved";
26
26
  NotificationType["LEAVE_REQUEST_REJECTED"] = "leave_request_rejected";
27
+ NotificationType["TIMESHEET_SUBMITTED"] = "timesheet_submitted";
28
+ NotificationType["TIMESHEET_APPROVED"] = "timesheet_approved";
29
+ NotificationType["TIMESHEET_REJECTED"] = "timesheet_rejected";
27
30
  NotificationType["SIGNUP_CONFIRMATION"] = "signup_confirmation";
28
31
  NotificationType["PASSWORD_RECOVERY"] = "password_recovery";
29
32
  })(NotificationType || (exports.NotificationType = NotificationType = {}));
@@ -16,6 +16,8 @@ export type TaskSummary = {
16
16
  status: StatusEntity | null;
17
17
  priority: number;
18
18
  assigned_to: UserIdentity | null;
19
+ project: ProjectIdentity | null;
20
+ client: ClientIdentity | null;
19
21
  };
20
22
  export type TaskEntity = {
21
23
  mms_id: string;
@@ -0,0 +1,57 @@
1
+ import { TimesheetReviewDecision, TimesheetStatus } from '../enum';
2
+ /**
3
+ * The wire shapes of the timesheet routes. The api runs a global ValidationPipe with
4
+ * `forbidNonWhitelisted`, so every field a route accepts is declared here and mirrored by
5
+ * the sdk's class-validator DTO. Dates travel as `YYYY-MM-DD` strings, times as `HH:MM`.
6
+ *
7
+ * Body fields are required keys: a field that may be empty is sent as `null`, never left
8
+ * out, so a payload always says what it means. Only query-string filters are optional.
9
+ */
10
+ export type TimesheetIdDto = {
11
+ timesheetId: string;
12
+ };
13
+ /** One list for everyone: `user_id` narrows it (to yourself, say); the api scopes what is visible. */
14
+ export type GetTimesheetsDto = {
15
+ page: number;
16
+ page_size: number;
17
+ user_id?: string | null;
18
+ status?: TimesheetStatus | null;
19
+ /** A Monday; keeps only that week. */
20
+ week_start?: string | null;
21
+ };
22
+ export type ReviewTimesheetDto = {
23
+ status: TimesheetReviewDecision;
24
+ review_note: string | null;
25
+ };
26
+ /** Approved weeks only; the span may not exceed a year. */
27
+ export type GetTimesheetReportDto = {
28
+ date_from: string;
29
+ date_to: string;
30
+ user_id?: string | null;
31
+ };
32
+ export type TimesheetEntryIdDto = {
33
+ timesheetEntryId: string;
34
+ };
35
+ /**
36
+ * Always the caller's own entry: there is no `user_id` to log on someone's behalf. The week
37
+ * is found or created from `date`; the duration is derived from the two times.
38
+ */
39
+ export type CreateTimesheetEntryDto = {
40
+ date: string;
41
+ start_time: string;
42
+ end_time: string;
43
+ client_id: string | null;
44
+ project_id: string | null;
45
+ task_id: string | null;
46
+ description: string | null;
47
+ };
48
+ /** Only an entry in a draft or rejected week can be edited; a moved date checks both weeks. */
49
+ export type UpdateTimesheetEntryDto = {
50
+ date: string;
51
+ start_time: string;
52
+ end_time: string;
53
+ client_id: string | null;
54
+ project_id: string | null;
55
+ task_id: string | null;
56
+ description: string | null;
57
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,17 @@
1
+ /**
2
+ * The lifecycle of a timesheet week. Stored as text on `timesheets.status` and validated
3
+ * here, never by a Postgres enum. A week is created as `draft` by its first entry, moves to
4
+ * `submitted` when the employee sends it, then to `approved` (entries lock) or `rejected`
5
+ * (entries reopen and the week may be submitted again).
6
+ */
1
7
  export declare enum TimesheetStatus {
8
+ DRAFT = "draft",
2
9
  SUBMITTED = "submitted",
3
10
  APPROVED = "approved",
4
11
  REJECTED = "rejected"
5
12
  }
13
+ /** The two outcomes a reviewer may give a submitted week. */
14
+ export declare enum TimesheetReviewDecision {
15
+ APPROVED = "approved",
16
+ REJECTED = "rejected"
17
+ }
@@ -1,10 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimesheetStatus = void 0;
3
+ exports.TimesheetReviewDecision = exports.TimesheetStatus = void 0;
4
+ /**
5
+ * The lifecycle of a timesheet week. Stored as text on `timesheets.status` and validated
6
+ * here, never by a Postgres enum. A week is created as `draft` by its first entry, moves to
7
+ * `submitted` when the employee sends it, then to `approved` (entries lock) or `rejected`
8
+ * (entries reopen and the week may be submitted again).
9
+ */
4
10
  var TimesheetStatus;
5
11
  (function (TimesheetStatus) {
12
+ TimesheetStatus["DRAFT"] = "draft";
6
13
  TimesheetStatus["SUBMITTED"] = "submitted";
7
14
  TimesheetStatus["APPROVED"] = "approved";
8
15
  TimesheetStatus["REJECTED"] = "rejected";
9
16
  })(TimesheetStatus || (exports.TimesheetStatus = TimesheetStatus = {}));
10
17
  ;
18
+ /** The two outcomes a reviewer may give a submitted week. */
19
+ var TimesheetReviewDecision;
20
+ (function (TimesheetReviewDecision) {
21
+ TimesheetReviewDecision["APPROVED"] = "approved";
22
+ TimesheetReviewDecision["REJECTED"] = "rejected";
23
+ })(TimesheetReviewDecision || (exports.TimesheetReviewDecision = TimesheetReviewDecision = {}));
@@ -0,0 +1,83 @@
1
+ import { TimesheetStatus } from './enum';
2
+ import { UserIdentity } from '../users';
3
+ import { ClientIdentity } from '../clients';
4
+ import { ProjectIdentity } from '../projects';
5
+ import { TaskIdentity } from '../tasks';
6
+ export * from './enum';
7
+ /**
8
+ * Timesheets, the second slice of the HR module: time entries an employee logs against a
9
+ * Monday-to-Sunday week, submits as one, and a manager approves or rejects with a note.
10
+ * Dates are calendar dates (`YYYY-MM-DD`); times are wall-clock `HH:MM` on that date, so an
11
+ * entry never crosses midnight - split it. The same reporting line as leave decides who sees
12
+ * and reviews what.
13
+ */
14
+ export type TimesheetEntryEntity = {
15
+ mms_id: string;
16
+ created_at: string;
17
+ created_by: UserIdentity | null;
18
+ updated_at: string | null;
19
+ last_updated_by: UserIdentity | null;
20
+ /** The week this entry belongs to, created as a draft by the first entry dated inside it. */
21
+ timesheet_id: string;
22
+ user: UserIdentity;
23
+ date: string;
24
+ /** `HH:MM`; `24:00` is allowed as an end for a shift finishing at midnight. */
25
+ start_time: string;
26
+ end_time: string;
27
+ /** Stored by Postgres from the two times, never sent by the client. */
28
+ duration_minutes: number;
29
+ /** Optional attribution; each survives the deletion of what it points at as null. */
30
+ client: ClientIdentity | null;
31
+ project: ProjectIdentity | null;
32
+ task: TaskIdentity | null;
33
+ description: string | null;
34
+ };
35
+ /** One week as the list shows it: the totals are counted on read, never stored. */
36
+ export type TimesheetSummary = {
37
+ mms_id: string;
38
+ created_at: string;
39
+ created_by: UserIdentity | null;
40
+ updated_at: string | null;
41
+ last_updated_by: UserIdentity | null;
42
+ user: UserIdentity;
43
+ /** Always a Monday; `week_end` is its Sunday. */
44
+ week_start: string;
45
+ week_end: string;
46
+ status: TimesheetStatus;
47
+ /** Null while the week is a draft; reset when a rejected week is resubmitted. */
48
+ submitted_at: string | null;
49
+ reviewed_by: UserIdentity | null;
50
+ reviewed_at: string | null;
51
+ review_note: string | null;
52
+ total_minutes: number;
53
+ entry_count: number;
54
+ };
55
+ export type TimesheetEntity = TimesheetSummary & {
56
+ entries: TimesheetEntryEntity[];
57
+ };
58
+ /**
59
+ * Hours over a date range, approved weeks only, grouped four ways from the same entries.
60
+ * Null `client` / `project` collects the entries logged without one.
61
+ */
62
+ export type TimesheetReportEntity = {
63
+ date_from: string;
64
+ date_to: string;
65
+ total_minutes: number;
66
+ by_user: {
67
+ user: UserIdentity;
68
+ total_minutes: number;
69
+ }[];
70
+ by_client: {
71
+ client: ClientIdentity | null;
72
+ total_minutes: number;
73
+ }[];
74
+ by_project: {
75
+ project: ProjectIdentity | null;
76
+ client: ClientIdentity | null;
77
+ total_minutes: number;
78
+ }[];
79
+ by_day: {
80
+ date: string;
81
+ total_minutes: number;
82
+ }[];
83
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enum"), exports);
@@ -31,6 +31,8 @@ export type UpdateUserDto = {
31
31
  employment_type?: EmploymentType | null;
32
32
  job_title?: string | null;
33
33
  manager_id?: string | null;
34
+ /** Must differ from `manager_id` and needs a manager set first; the api refuses otherwise. */
35
+ secondary_manager_id?: string | null;
34
36
  social_facebook?: string | null;
35
37
  social_linkedin?: string | null;
36
38
  social_twitter?: string | null;
@@ -49,7 +51,7 @@ export type UpdateUserDto = {
49
51
  * behind `update_users`. Absent here on purpose:
50
52
  * job_title, employment_type,
51
53
  * start_date, end_date - HR-owned work details, not self-service
52
- * manager_id - an org structure decision
54
+ * manager_id, secondary_manager_id - an org structure decision
53
55
  * email - GoTrue's, changed through the auth flow
54
56
  * profile_image - set by POST /users/me/profile-image, never by the client
55
57
  */
@@ -32,6 +32,8 @@ export interface UserEntity {
32
32
  updated_at: Date | null;
33
33
  last_updated_by: UserIdentity | null;
34
34
  manager: UserIdentity | null;
35
+ /** Either manager may review a report's leave and timesheets; only the primary is emailed. */
36
+ secondary_manager: UserIdentity | null;
35
37
  birthday: Date | null;
36
38
  employment_type: EmploymentType;
37
39
  job_title: string | null;
@@ -137,6 +139,7 @@ export interface Permissions {
137
139
  projects: CrudPermission;
138
140
  project_budgets: CrudPermission;
139
141
  tasks: CrudPermission;
142
+ timesheets: CrudPermission;
140
143
  invoices: Omit<CrudPermission, 'create' | 'update' | 'delete'>;
141
144
  leave_types: CrudPermission;
142
145
  leave_entitlements: CrudPermission;
@@ -11,6 +11,10 @@ export type UpdatePermissionsDto = {
11
11
  read_tasks: boolean;
12
12
  update_tasks: boolean;
13
13
  delete_tasks: boolean;
14
+ create_timesheets: boolean;
15
+ read_timesheets: boolean;
16
+ update_timesheets: boolean;
17
+ delete_timesheets: boolean;
14
18
  create_leave: boolean;
15
19
  read_leave: boolean;
16
20
  update_leave: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.22.1",
3
+ "version": "1.23.1",
4
4
  "description": "Entity types used by both the api and portal",
5
5
  "homepage": "https://github.com/ManageMint-Solutions/managemint-solutions-entities#readme",
6
6
  "bugs": {