@managemint-solutions/entities 1.35.0 → 1.36.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.
@@ -27,7 +27,8 @@ export declare enum AuditTrailEntityType {
27
27
  LEAVE_ADJUSTMENTS = "leave_adjustments",
28
28
  BILLING_TRANSACTIONS = "billing_transactions",
29
29
  INVOICE = "invoices",
30
- NOTIFICATION = "notifications"
30
+ NOTIFICATION = "notifications",
31
+ USER_API_CREDENTIAL = "user_api_credentials"
31
32
  }
32
33
  export declare enum AuditTrailChangeType {
33
34
  TEXT = "text",
@@ -33,6 +33,7 @@ var AuditTrailEntityType;
33
33
  AuditTrailEntityType["BILLING_TRANSACTIONS"] = "billing_transactions";
34
34
  AuditTrailEntityType["INVOICE"] = "invoices";
35
35
  AuditTrailEntityType["NOTIFICATION"] = "notifications";
36
+ AuditTrailEntityType["USER_API_CREDENTIAL"] = "user_api_credentials";
36
37
  })(AuditTrailEntityType || (exports.AuditTrailEntityType = AuditTrailEntityType = {}));
37
38
  var AuditTrailChangeType;
38
39
  (function (AuditTrailChangeType) {
@@ -8,6 +8,10 @@ export type GetClientsDto = {
8
8
  status_id_in?: string | null;
9
9
  archive: boolean;
10
10
  };
11
+ /** A staff read across organizations, optionally narrowed to one of them. */
12
+ export type StaffGetClientsDto = GetClientsDto & {
13
+ organization_id?: string | null;
14
+ };
11
15
  export type ClientIdDto = {
12
16
  clientId: string;
13
17
  };
@@ -1,6 +1,7 @@
1
1
  import type { UUID } from 'crypto';
2
2
  import { UserIdentity } from '../users';
3
3
  import { StatusEntity } from '../status';
4
+ import type { OrganizationIdentity } from '../organization';
4
5
  export type ClientIdentity = {
5
6
  mms_id: UUID;
6
7
  name: string;
@@ -12,6 +13,8 @@ export type ClientSummary = {
12
13
  email: string;
13
14
  status: StatusEntity | null;
14
15
  created_by: UserIdentity;
16
+ /** Present on staff reads only. */
17
+ organization?: OrganizationIdentity;
15
18
  };
16
19
  export type ClientEntity = {
17
20
  mms_id: UUID;
@@ -11,6 +11,10 @@ export type GetLeadsDto = {
11
11
  completed?: boolean | null;
12
12
  archive: boolean;
13
13
  };
14
+ /** A staff read across organizations, optionally narrowed to one of them. */
15
+ export type StaffGetLeadsDto = GetLeadsDto & {
16
+ organization_id?: string | null;
17
+ };
14
18
  export type LeadIdDto = {
15
19
  leadId: string;
16
20
  };
@@ -3,6 +3,7 @@ import { ClientIdentity } from '../clients';
3
3
  import { StatusEntity } from '../status';
4
4
  import { UserIdentity } from '../users';
5
5
  import { LeadSource } from './enum';
6
+ import type { OrganizationIdentity } from '../organization';
6
7
  export type LeadIdentity = {
7
8
  mms_id: UUID;
8
9
  name: string;
@@ -21,6 +22,8 @@ export type LeadSummary = {
21
22
  /** A date (YYYY-MM-DD) to follow the lead up; null when none is set. */
22
23
  follow_up_date: string | null;
23
24
  created_by: UserIdentity;
25
+ /** Present on staff reads only. */
26
+ organization?: OrganizationIdentity;
24
27
  };
25
28
  /**
26
29
  * A prospective client. Converting it creates a client from its data, moves its notes,
@@ -63,3 +63,12 @@ export type UpdateOrganizationDto = {
63
63
  /** The month (1-12) the leave year starts on; shapes entitlements created after the change. */
64
64
  leave_calendar_start_month?: number;
65
65
  };
66
+ export type OrganizationIdDto = {
67
+ organizationId: string;
68
+ };
69
+ /** The staff list of every organization. `search` matches name, trading name and email. */
70
+ export type GetOrganizationsDto = {
71
+ search?: string | null;
72
+ page: number;
73
+ page_size: number;
74
+ };
@@ -3,6 +3,23 @@ import { PricebookWithModules, PricedModule } from '../modules/index';
3
3
  import { UserIdentity } from '../users';
4
4
  import { BillingStatus } from '../billing/enum';
5
5
  import { PaymentFrequency } from './enum';
6
+ /** Which organization a row belongs to, as a staff read across organizations shows it. */
7
+ export type OrganizationIdentity = {
8
+ mms_id: UUID;
9
+ name: string;
10
+ };
11
+ /** An organization as the staff list shows it. `modules` holds the module keys it owns. */
12
+ export type OrganizationSummary = {
13
+ mms_id: UUID;
14
+ created_at: Date;
15
+ name: string;
16
+ trading_name: string;
17
+ email: string;
18
+ billing_status: BillingStatus;
19
+ active_seat_count: number;
20
+ paid_seat_count: number;
21
+ modules: string[];
22
+ };
6
23
  export type OrganizationEntity = {
7
24
  mms_id: UUID;
8
25
  created_at: Date;
@@ -17,6 +17,10 @@ export type GetProjectsDto = {
17
17
  client_id?: string | null;
18
18
  archive: boolean;
19
19
  };
20
+ /** A staff read across organizations, optionally narrowed to one of them. */
21
+ export type StaffGetProjectsDto = GetProjectsDto & {
22
+ organization_id?: string | null;
23
+ };
20
24
  export type CreateProjectDto = {
21
25
  name: string;
22
26
  specification?: string | null;
@@ -2,6 +2,7 @@ import { UUID } from "crypto";
2
2
  import { UserIdentity } from "../users";
3
3
  import { ClientIdentity } from "../clients";
4
4
  import { StatusEntity } from "../status";
5
+ import type { OrganizationIdentity } from "../organization";
5
6
  export type ProjectIdentity = {
6
7
  mms_id: UUID;
7
8
  name: string;
@@ -16,6 +17,8 @@ export type ProjectSummary = {
16
17
  status: StatusEntity | null;
17
18
  manager: UserIdentity | null;
18
19
  client: ClientIdentity | null;
20
+ /** Present on staff reads only. */
21
+ organization?: OrganizationIdentity;
19
22
  };
20
23
  export type ProjectEntity = {
21
24
  mms_id: UUID;
@@ -0,0 +1,13 @@
1
+ import type { UpdatePermissionsDto } from '../../users/permissions/dto';
2
+ export type CreateStaffDto = {
3
+ email: string;
4
+ name: string;
5
+ password: string;
6
+ };
7
+ export type UpdateStaffPermissionsDto = UpdatePermissionsDto & {
8
+ is_admin: boolean;
9
+ view_dashboard: boolean;
10
+ };
11
+ export type StaffIdDto = {
12
+ staffId: string;
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import type { UUID } from 'crypto';
2
+ import type { PermissionsEntity } from '../users';
3
+ /** A ManageMint Solutions employee. `mms_id` is their auth user id. */
4
+ export type StaffEntity = {
5
+ mms_id: UUID;
6
+ email: string;
7
+ name: string;
8
+ active: boolean;
9
+ created_at: Date;
10
+ created_by: UUID | null;
11
+ deactivated_at: Date | null;
12
+ deactivated_by: UUID | null;
13
+ };
14
+ /** A staff member's flags: a tenant permissions row with no organization and no owner. */
15
+ export type StaffPermissionsEntity = Omit<PermissionsEntity, 'user_id' | 'organization_id' | 'is_owner'> & {
16
+ staff_id: UUID;
17
+ };
18
+ /** A staff member with their flags: the signed-in one (`/staff/me`) or any other (`/staff/:staffId`). */
19
+ export type StaffDetail = {
20
+ staff: StaffEntity;
21
+ permissions: StaffPermissionsEntity;
22
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -30,6 +30,10 @@ export type GetTasksDto = {
30
30
  label_id_in?: string | null;
31
31
  archive: boolean;
32
32
  };
33
+ /** A staff read across organizations, optionally narrowed to one of them. */
34
+ export type StaffGetTasksDto = GetTasksDto & {
35
+ organization_id?: string | null;
36
+ };
33
37
  export type CreateTaskDto = {
34
38
  name: string;
35
39
  description?: string | null;
@@ -3,6 +3,7 @@ import { LabelEntity } from "../labels";
3
3
  import { ProjectIdentity } from "../projects";
4
4
  import { StatusEntity } from "../status";
5
5
  import { UserIdentity } from "../users";
6
+ import type { OrganizationIdentity } from "../organization";
6
7
  export type TaskIdentity = {
7
8
  mms_id: string;
8
9
  name: string;
@@ -32,6 +33,8 @@ export type TaskSummary = {
32
33
  assigned_to: UserIdentity | null;
33
34
  project: ProjectIdentity | null;
34
35
  client: ClientIdentity | null;
36
+ /** Present on staff reads only. */
37
+ organization?: OrganizationIdentity;
35
38
  };
36
39
  export type TaskEntity = {
37
40
  mms_id: string;
@@ -0,0 +1,12 @@
1
+ export type CreateUserApiCredentialDto = {
2
+ label: string;
3
+ /** ISO 8601; null or omitted never expires. */
4
+ expires_at?: string | null;
5
+ };
6
+ export type MintEmulationTokenDto = {
7
+ client_id: string;
8
+ client_secret: string;
9
+ };
10
+ export type UserApiCredentialIdDto = {
11
+ credentialId: string;
12
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ import type { UUID } from 'crypto';
2
+ /**
3
+ * A client id and secret staff issue for one user: exchanging them mints an access token that
4
+ * acts as that user. The secret is stored as a hash and never read back.
5
+ */
6
+ export type UserApiCredentialEntity = {
7
+ mms_id: UUID;
8
+ user_id: UUID;
9
+ organization_id: UUID;
10
+ client_id: string;
11
+ label: string;
12
+ created_at: Date;
13
+ /** The staff member who issued it. */
14
+ created_by: UUID;
15
+ expires_at: Date | null;
16
+ revoked_at: Date | null;
17
+ revoked_by: UUID | null;
18
+ last_used_at: Date | null;
19
+ };
20
+ /** The credential as it is issued: the only time the secret is ever shown. */
21
+ export type CreatedUserApiCredential = UserApiCredentialEntity & {
22
+ client_secret: string;
23
+ };
24
+ /** A short-lived access token for the credential's user, marked as emulated. */
25
+ export type MintEmulationTokenResponse = {
26
+ access_token: string;
27
+ token_type: 'Bearer';
28
+ expires_at: string;
29
+ user: {
30
+ mms_id: UUID;
31
+ organization_id: UUID;
32
+ };
33
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,6 +11,10 @@ export type GetUsersDto = {
11
11
  /** A manager's team: everyone naming this user as their manager or second manager. */
12
12
  manager_id?: string | null;
13
13
  };
14
+ /** A staff read across organizations, optionally narrowed to one of them. */
15
+ export type StaffGetUsersDto = GetUsersDto & {
16
+ organization_id?: string | null;
17
+ };
14
18
  export type CreateUserDto = {
15
19
  email: string;
16
20
  password: string;
@@ -1,5 +1,6 @@
1
1
  import type { UUID } from 'crypto';
2
2
  import { EmergencyContactRelationship, EmploymentType } from './enum';
3
+ import type { OrganizationIdentity } from '../organization';
3
4
  export interface UserIdentity {
4
5
  mms_id: UUID;
5
6
  name: string;
@@ -16,6 +17,8 @@ export interface UserSummary {
16
17
  active: boolean;
17
18
  created_at: Date;
18
19
  last_logged_in: Date | null;
20
+ /** Present on staff reads only. */
21
+ organization?: OrganizationIdentity;
19
22
  }
20
23
  export interface UserEntity {
21
24
  mms_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.35.0",
3
+ "version": "1.36.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": {