@managemint-solutions/entities 1.22.0 → 1.23.0

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.
Files changed (39) hide show
  1. package/dist/audit-trail/enum/index.d.ts +1 -0
  2. package/dist/audit-trail/enum/index.js +1 -0
  3. package/dist/billing/enum/index.d.ts +1 -1
  4. package/dist/billing/enum/index.js +1 -1
  5. package/dist/billing/index.d.ts +2 -2
  6. package/dist/billing/index.js +1 -1
  7. package/dist/billing/invoices/index.d.ts +3 -3
  8. package/dist/billing/payments/index.d.ts +3 -3
  9. package/dist/configs/dto/index.d.ts +1 -1
  10. package/dist/configs/index.d.ts +1 -1
  11. package/dist/feature-requests/dto/index.d.ts +1 -1
  12. package/dist/feature-requests/enum/index.d.ts +1 -1
  13. package/dist/feature-requests/enum/index.js +1 -1
  14. package/dist/feature-requests/index.d.ts +2 -2
  15. package/dist/leave/dto/index.d.ts +4 -0
  16. package/dist/leave/index.d.ts +6 -0
  17. package/dist/modules/index.d.ts +2 -2
  18. package/dist/modules/index.js +1 -1
  19. package/dist/notifications/enum/index.d.ts +3 -0
  20. package/dist/notifications/enum/index.js +3 -0
  21. package/dist/organization/dto/index.d.ts +1 -1
  22. package/dist/organization/enum/index.d.ts +1 -1
  23. package/dist/organization/enum/index.js +1 -1
  24. package/dist/organization/index.d.ts +1 -1
  25. package/dist/paystack/enum/index.d.ts +2 -2
  26. package/dist/paystack/enum/index.js +2 -2
  27. package/dist/paystack/index.d.ts +1 -1
  28. package/dist/resend/webhook/index.d.ts +1 -1
  29. package/dist/support/dto/index.d.ts +3 -3
  30. package/dist/timesheets/dto/index.d.ts +57 -0
  31. package/dist/timesheets/dto/index.js +2 -0
  32. package/dist/timesheets/enum/index.d.ts +12 -0
  33. package/dist/timesheets/enum/index.js +14 -1
  34. package/dist/timesheets/index.d.ts +83 -0
  35. package/dist/timesheets/index.js +17 -0
  36. package/dist/users/dto/index.d.ts +3 -1
  37. package/dist/users/index.d.ts +3 -0
  38. package/dist/users/permissions/dto/index.d.ts +4 -0
  39. package/package.json +1 -1
@@ -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";
@@ -40,7 +40,7 @@ export declare enum BillingEventSource {
40
40
  SCHEDULER = "scheduler"
41
41
  }
42
42
  /**
43
- * Billing ledger event names — the values written to billing_events.event_type.
43
+ * Billing ledger event names - the values written to billing_events.event_type.
44
44
  * Distinct from BillingStatus (which is the organization's current billing state)
45
45
  * even though a couple of values coincide, e.g. cancellation_requested.
46
46
  */
@@ -53,7 +53,7 @@ var BillingEventSource;
53
53
  })(BillingEventSource || (exports.BillingEventSource = BillingEventSource = {}));
54
54
  ;
55
55
  /**
56
- * Billing ledger event names — the values written to billing_events.event_type.
56
+ * Billing ledger event names - the values written to billing_events.event_type.
57
57
  * Distinct from BillingStatus (which is the organization's current billing state)
58
58
  * even though a couple of values coincide, e.g. cancellation_requested.
59
59
  */
@@ -2,7 +2,7 @@ import { BillingEventSource, BillingEventType, BillingTransactionStatus, Billing
2
2
  /**
3
3
  * Day of the month every billing period is anchored on. The period containing a
4
4
  * given date runs from the most recent 25th (inclusive) to the next 25th
5
- * (exclusive) — the anchor day itself belongs to the new period.
5
+ * (exclusive) - the anchor day itself belongs to the new period.
6
6
  */
7
7
  export declare const BILLING_ANCHOR_DAY = 25;
8
8
  export type BillingPeriod = {
@@ -31,7 +31,7 @@ export type CreateTransactionInput = {
31
31
  prorationEndAt?: Date | null;
32
32
  /**
33
33
  * Defaults to INITIALIZED. Pass PAID (with paidAt) for transactions recorded
34
- * after the fact, e.g. subscription renewals reported by webhook — inserting
34
+ * after the fact, e.g. subscription renewals reported by webhook - inserting
35
35
  * them directly as paid keeps them out of the one-open-transaction-per-
36
36
  * organization unique index.
37
37
  */
@@ -4,6 +4,6 @@ exports.BILLING_ANCHOR_DAY = void 0;
4
4
  /**
5
5
  * Day of the month every billing period is anchored on. The period containing a
6
6
  * given date runs from the most recent 25th (inclusive) to the next 25th
7
- * (exclusive) — the anchor day itself belongs to the new period.
7
+ * (exclusive) - the anchor day itself belongs to the new period.
8
8
  */
9
9
  exports.BILLING_ANCHOR_DAY = 25;
@@ -1,7 +1,7 @@
1
1
  import { BillingTransactionStatus, BillingTransactionType } from "../enum";
2
2
  /** One priced line on an invoice document, frozen at issue time. */
3
3
  export type InvoiceLineItem = {
4
- /** The bold line: the module, e.g. "Core — subscription". */
4
+ /** The bold line: the module, e.g. "Core - subscription". */
5
5
  label: string;
6
6
  /** The grey sub-line: "12 seats · 2 Sep – 25 Sep 2026 (23 of 31 days)". */
7
7
  detail?: string | null;
@@ -27,7 +27,7 @@ export type InvoiceSummary = {
27
27
  };
28
28
  /**
29
29
  * The full invoice document data. `line_items` and `billed_to` are snapshots
30
- * frozen when the invoice was written — the document must not change when the
30
+ * frozen when the invoice was written - the document must not change when the
31
31
  * organization later edits its billing address or the pricebook moves on.
32
32
  */
33
33
  export type InvoiceEntity = InvoiceSummary & {
@@ -44,7 +44,7 @@ export type InvoiceEntity = InvoiceSummary & {
44
44
  registration_number: string | null;
45
45
  };
46
46
  };
47
- /** Response of GET /billing/invoices/:invoiceId/html — the A4 document markup. */
47
+ /** Response of GET /billing/invoices/:invoiceId/html - the A4 document markup. */
48
48
  export type InvoiceHtmlResponse = {
49
49
  html: string;
50
50
  };
@@ -1,8 +1,8 @@
1
1
  import { BillingTransactionStatus, BillingTransactionType } from "../enum";
2
2
  /**
3
3
  * One row of GET /billing/payments: a billing_transactions ledger row as the portal
4
- * lists it. Every charge is a payment — the initial subscription, a pro-rata seat or
5
- * module charge, a reinstatement and a monthly renewal alike — whether or not it
4
+ * lists it. Every charge is a payment - the initial subscription, a pro-rata seat or
5
+ * module charge, a reinstatement and a monthly renewal alike - whether or not it
6
6
  * settled. Invoices are the separate accounting documents that only renewals issue.
7
7
  */
8
8
  export type PaymentSummary = {
@@ -26,6 +26,6 @@ export type PaymentEntity = PaymentSummary & {
26
26
  proration_start_at: string | null;
27
27
  proration_end_at: string | null;
28
28
  paystack_reference: string | null;
29
- /** The invoice this payment issued — renewals only; null for every other type. */
29
+ /** The invoice this payment issued - renewals only; null for every other type. */
30
30
  invoice_id: string | null;
31
31
  };
@@ -4,7 +4,7 @@ export type CreateConfigDto = {
4
4
  description?: string;
5
5
  value?: ConfigValue;
6
6
  };
7
- /** `value` replaces the whole object — it is not merged. `name` is the lookup key and is not editable here. */
7
+ /** `value` replaces the whole object - it is not merged. `name` is the lookup key and is not editable here. */
8
8
  export type UpdateConfigDto = {
9
9
  description?: string;
10
10
  value?: ConfigValue;
@@ -6,7 +6,7 @@ export type JsonValue = string | number | boolean | null | JsonValue[] | {
6
6
  /** The `value` column: one JSON object keyed by setting name. */
7
7
  export type ConfigValue = Record<string, JsonValue>;
8
8
  /**
9
- * One named config — a row of `public.configs`. Global: there is no organization on the row.
9
+ * One named config - a row of `public.configs`. Global: there is no organization on the row.
10
10
  * Every signed-in caller may read; only the service role writes. A feature-flag set is just a
11
11
  * row someone named in Supabase Studio, not a concept the code knows about.
12
12
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The body of `POST /feature-requests`. Every field the endpoint accepts is here: the api's
3
3
  * global ValidationPipe runs with `forbidNonWhitelisted`, so anything not on this contract is
4
- * a 400 — the honeypot included, which is why it is a declared field rather than a stray one.
4
+ * a 400 - the honeypot included, which is why it is a declared field rather than a stray one.
5
5
  *
6
6
  * `source` is absent on purpose: the api sets it from `FeatureRequestSource`, never from the
7
7
  * request.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Where a feature request came in from. Stored as text and set server-side by the api — the
2
+ * Where a feature request came in from. Stored as text and set server-side by the api - the
3
3
  * client never sends it, so a second intake (an in-portal "suggest a feature", say) adds a
4
4
  * member here rather than trusting a request field.
5
5
  */
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FeatureRequestSource = void 0;
4
4
  /**
5
- * Where a feature request came in from. Stored as text and set server-side by the api — the
5
+ * Where a feature request came in from. Stored as text and set server-side by the api - the
6
6
  * client never sends it, so a second intake (an in-portal "suggest a feature", say) adds a
7
7
  * member here rather than trusting a request field.
8
8
  */
@@ -6,7 +6,7 @@ export * from './enum';
6
6
  *
7
7
  * Deliberately tenant-less: the person filling the form has no account, so there is no
8
8
  * `organization_id` and no `created_by` to record. The row is read in Supabase Studio and
9
- * nowhere else — nothing in the portal or on the website ever renders one back.
9
+ * nowhere else - nothing in the portal or on the website ever renders one back.
10
10
  */
11
11
  export type FeatureRequestEntity = {
12
12
  mms_id: UUID;
@@ -14,7 +14,7 @@ export type FeatureRequestEntity = {
14
14
  name: string;
15
15
  /** Markdown, as typed. Optional on the form, so an empty submission is stored as null. */
16
16
  specification: string | null;
17
- /** Whatever the requester called themselves — a person, a company, or both. */
17
+ /** Whatever the requester called themselves - a person, a company, or both. */
18
18
  requester_name: string;
19
19
  requester_email: string;
20
20
  source: FeatureRequestSource;
@@ -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
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Module keys the API gates features on. These MUST match billing_modules.module_key
3
- * rows in the database — the database decides which modules exist and what they cost;
3
+ * rows in the database - the database decides which modules exist and what they cost;
4
4
  * this only declares which of them unlock which features.
5
5
  *
6
6
  * Module selection is never validated against this: requests carry module ids, which
@@ -30,7 +30,7 @@ export type PricedModule = {
30
30
  currency: string;
31
31
  };
32
32
  /**
33
- * A frozen price list version. Exactly one pricebook is active at a time — the
33
+ * A frozen price list version. Exactly one pricebook is active at a time - the
34
34
  * one new organizations are pinned to and the one an organization moves to when
35
35
  * it buys a module. Organizations on older pricebooks keep paying those prices
36
36
  * until they change something (grandfathering).
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MODULE_KEYS = void 0;
4
4
  /**
5
5
  * Module keys the API gates features on. These MUST match billing_modules.module_key
6
- * rows in the database — the database decides which modules exist and what they cost;
6
+ * rows in the database - the database decides which modules exist and what they cost;
7
7
  * this only declares which of them unlock which features.
8
8
  *
9
9
  * Module selection is never validated against this: requests carry module ids, which
@@ -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 = {}));
@@ -21,7 +21,7 @@ export type CreateOrganizationDto = {
21
21
  org_billing_state?: string | null;
22
22
  org_billing_postal_code?: string | null;
23
23
  org_billing_country?: string | null;
24
- /** Terms & conditions acceptance — the API refuses anything but `true`. */
24
+ /** Terms & conditions acceptance - the API refuses anything but `true`. */
25
25
  org_consent_given: true;
26
26
  org_industry?: string | null;
27
27
  org_marketting_consent_given: boolean;
@@ -3,7 +3,7 @@ export declare enum OrganizationTypes {
3
3
  SOLE_TRADER = "Sole-Trader"
4
4
  }
5
5
  /**
6
- * How often an organization is billed. Only monthly billing exists today — add
6
+ * How often an organization is billed. Only monthly billing exists today - add
7
7
  * members when the product supports more.
8
8
  */
9
9
  export declare enum PaymentFrequency {
@@ -8,7 +8,7 @@ var OrganizationTypes;
8
8
  })(OrganizationTypes || (exports.OrganizationTypes = OrganizationTypes = {}));
9
9
  ;
10
10
  /**
11
- * How often an organization is billed. Only monthly billing exists today — add
11
+ * How often an organization is billed. Only monthly billing exists today - add
12
12
  * members when the product supports more.
13
13
  */
14
14
  var PaymentFrequency;
@@ -39,7 +39,7 @@ export type OrganizationEntity = {
39
39
  leave_calendar_start_month: number;
40
40
  billing_cycle_locked: boolean;
41
41
  /**
42
- * The modules the organization subscribes to, priced at ITS pricebook's rates —
42
+ * The modules the organization subscribes to, priced at ITS pricebook's rates -
43
43
  * i.e. what it actually pays, which may be an older pricebook than the active one.
44
44
  */
45
45
  modules: PricedModule[];
@@ -13,7 +13,7 @@ export declare enum PaystackWebhookEvent {
13
13
  TRANSACTION_SUCCESSFUL = "charge.success"
14
14
  }
15
15
  /**
16
- * Paystack's own subscription vocabulary — an external contract we do not own, so
16
+ * Paystack's own subscription vocabulary - an external contract we do not own, so
17
17
  * this is not necessarily exhaustive. Provided for comparison sites only; the
18
18
  * `status` fields on the payload interfaces deliberately stay `string`.
19
19
  */
@@ -25,7 +25,7 @@ export declare enum PaystackSubscriptionStatus {
25
25
  CANCELLED = "cancelled"
26
26
  }
27
27
  /**
28
- * Paystack's own transaction vocabulary — an external contract we do not own, so
28
+ * Paystack's own transaction vocabulary - an external contract we do not own, so
29
29
  * this is not necessarily exhaustive. Provided for comparison sites only; the
30
30
  * `status` fields on the payload interfaces deliberately stay `string`.
31
31
  * Only SUCCESS means the charge completed and the money moved.
@@ -18,7 +18,7 @@ var PaystackWebhookEvent;
18
18
  })(PaystackWebhookEvent || (exports.PaystackWebhookEvent = PaystackWebhookEvent = {}));
19
19
  ;
20
20
  /**
21
- * Paystack's own subscription vocabulary — an external contract we do not own, so
21
+ * Paystack's own subscription vocabulary - an external contract we do not own, so
22
22
  * this is not necessarily exhaustive. Provided for comparison sites only; the
23
23
  * `status` fields on the payload interfaces deliberately stay `string`.
24
24
  */
@@ -32,7 +32,7 @@ var PaystackSubscriptionStatus;
32
32
  })(PaystackSubscriptionStatus || (exports.PaystackSubscriptionStatus = PaystackSubscriptionStatus = {}));
33
33
  ;
34
34
  /**
35
- * Paystack's own transaction vocabulary — an external contract we do not own, so
35
+ * Paystack's own transaction vocabulary - an external contract we do not own, so
36
36
  * this is not necessarily exhaustive. Provided for comparison sites only; the
37
37
  * `status` fields on the payload interfaces deliberately stay `string`.
38
38
  * Only SUCCESS means the charge completed and the money moved.
@@ -143,7 +143,7 @@ export type PaystackChargeAuthorizationResponse = {
143
143
  /**
144
144
  * A 2xx from Paystack only means the request was accepted. See
145
145
  * PaystackTransactionStatus; only PaystackTransactionStatus.SUCCESS means the
146
- * charge completed and the money moved — the rest are failure, pending, or
146
+ * charge completed and the money moved - the rest are failure, pending, or
147
147
  * challenge states such as SEND_OTP when the authorization is not reusable.
148
148
  */
149
149
  status: string;
@@ -28,7 +28,7 @@ export type ResendEmailEventData = {
28
28
  };
29
29
  /**
30
30
  * One inbound email as `email.received` delivers it. The payload is metadata
31
- * only — body text and attachment bytes are fetched from the receiving API
31
+ * only - body text and attachment bytes are fetched from the receiving API
32
32
  * with `email_id`.
33
33
  */
34
34
  export type ResendInboundEmailData = {
@@ -1,11 +1,11 @@
1
1
  import type { SupportTopic } from '../enum';
2
2
  /**
3
3
  * The body of `POST /support`. Every field the endpoint accepts is here: the api's global
4
- * ValidationPipe runs with `forbidNonWhitelisted`, so anything not on this contract is a 400 —
4
+ * ValidationPipe runs with `forbidNonWhitelisted`, so anything not on this contract is a 400 -
5
5
  * the honeypot included, which is why it is a declared field rather than a stray one.
6
6
  *
7
- * Nothing is stored. The api turns one of these into two emails — the message to the support
8
- * inbox, and an acknowledgement back to `email` — and that is the whole record of it.
7
+ * Nothing is stored. The api turns one of these into two emails - the message to the support
8
+ * inbox, and an acknowledgement back to `email` - and that is the whole record of it.
9
9
  */
10
10
  export type CreateSupportRequestDto = {
11
11
  topic: SupportTopic;
@@ -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.0",
3
+ "version": "1.23.0",
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": {