@updraft-solutions/mcrit-sdk 0.15.1 → 0.16.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.
- package/dist/{chunk-2NLL4S23.js → chunk-4T3JURL3.js} +43 -5
- package/dist/{chunk-LW6IEW22.cjs → chunk-7HPJT4VX.cjs} +43 -5
- package/dist/{fbo-CB-keksi.d.cts → fbo-TbdcUaI9.d.cts} +919 -889
- package/dist/{fbo-CB-keksi.d.ts → fbo-TbdcUaI9.d.ts} +919 -889
- package/dist/index.cjs +16 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -4
- package/dist/schemas/index.cjs +14 -2
- package/dist/schemas/index.d.cts +1948 -23
- package/dist/schemas/index.d.ts +1948 -23
- package/dist/schemas/index.js +13 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/schemas/form-template.ts +1 -0
- package/src/schemas/index.ts +1 -0
- package/src/schemas/models.ts +3 -2
- package/src/schemas/system-contract.spec.ts +54 -0
- package/src/schemas/system-contract.ts +37 -0
- package/src/schemas/todo.ts +5 -1
package/dist/schemas/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
AudienceBucketType,
|
|
8
8
|
BaseModel,
|
|
9
9
|
ButtonBlockSchema,
|
|
10
|
+
CompanySystemContractsResponseSchema,
|
|
10
11
|
CompanyUsersBucketSchema,
|
|
11
12
|
CourseMilestoneFormSchema,
|
|
12
13
|
CourseMilestoneKindEnum,
|
|
@@ -75,10 +76,15 @@ import {
|
|
|
75
76
|
SubmissionFileSchema,
|
|
76
77
|
SubmitFaqQuestionSchema,
|
|
77
78
|
SyllabusKindEnum,
|
|
79
|
+
SystemContractRegisterEntrySchema,
|
|
80
|
+
SystemContractRegisterResponseSchema,
|
|
81
|
+
SystemContractRegisterRowSchema,
|
|
82
|
+
SystemContractStateSchema,
|
|
78
83
|
TemplateSchemaSchema,
|
|
79
84
|
TipTapNodeSchema,
|
|
80
85
|
TodoActionSchema,
|
|
81
86
|
TodoKey,
|
|
87
|
+
TodoPrioritySchema,
|
|
82
88
|
TodoSchema,
|
|
83
89
|
TrainingElementFormSchema,
|
|
84
90
|
TrainingElementKindEnum,
|
|
@@ -247,7 +253,7 @@ import {
|
|
|
247
253
|
zMoneyObject,
|
|
248
254
|
zNetGross,
|
|
249
255
|
zNullableBool
|
|
250
|
-
} from "../chunk-
|
|
256
|
+
} from "../chunk-4T3JURL3.js";
|
|
251
257
|
export {
|
|
252
258
|
ALLOWED_GEOMETRY_TYPES,
|
|
253
259
|
ALLOWED_NEWSLETTER_VARIABLES,
|
|
@@ -257,6 +263,7 @@ export {
|
|
|
257
263
|
AudienceBucketType,
|
|
258
264
|
BaseModel,
|
|
259
265
|
ButtonBlockSchema,
|
|
266
|
+
CompanySystemContractsResponseSchema,
|
|
260
267
|
CompanyUsersBucketSchema,
|
|
261
268
|
CourseMilestoneFormSchema,
|
|
262
269
|
CourseMilestoneKindEnum,
|
|
@@ -325,10 +332,15 @@ export {
|
|
|
325
332
|
SubmissionFileSchema,
|
|
326
333
|
SubmitFaqQuestionSchema,
|
|
327
334
|
SyllabusKindEnum,
|
|
335
|
+
SystemContractRegisterEntrySchema,
|
|
336
|
+
SystemContractRegisterResponseSchema,
|
|
337
|
+
SystemContractRegisterRowSchema,
|
|
338
|
+
SystemContractStateSchema,
|
|
328
339
|
TemplateSchemaSchema,
|
|
329
340
|
TipTapNodeSchema,
|
|
330
341
|
TodoActionSchema,
|
|
331
342
|
TodoKey,
|
|
343
|
+
TodoPrioritySchema,
|
|
332
344
|
TodoSchema,
|
|
333
345
|
TrainingElementFormSchema,
|
|
334
346
|
TrainingElementKindEnum,
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, b3 as courseSchema, b1 as courseEnrollmentSchema, b2 as courseFeeSchema, aJ as airplaneIssueSeverityEnum, b9 as documentSchema, b5 as documentComplianceStatus, b6 as documentRequirement, b7 as documentRequirementGroup, b8 as documentRequirementGroupAssignment, ba as documentShareSchema, bb as documentType, bd as eventSchema, bf as expenseSchema, be as expenseItemSchema, bg as extendedAirplaneSchema, c0 as feeSchema, b$ as feeCategoryOptionsSchema, c1 as flightLogSchema, c6 as flightRequestSchema, c2 as flightRequestAvailabilitySchema, c3 as flightRequestBusyIntervalSchema, c4 as flightRequestResponseSchema, c5 as flightRequestResponseStatusSchema, c7 as flightRequestSeatSchema, c8 as flightRequestStatusSchema, c9 as flightRequestWindowSchema, ch as invoiceSchema, cj as landingSchema, ci as landingFeeSchema, cl as maintenanceEventSchema, ck as maintenanceEventEstimationSchema, cm as maintenanceStatusSchema, cn as mediaCollection, cq as membershipSchema, cr as membershipSignupSchema, ct as postSchema, cu as postSubjectSchema, cw as prePaidPackageSchema, cx as priceSchema, cy as qualificationSchema, cz as recurringFlightSchema, cA as roleSchema, cB as runwaySchema, cC as scheduledFlightSchema, cD as settingSchema, cE as specialFlightSchema, cL as tagSchema, cM as teachingPermissionSchema, cN as ticketSchema, cX as userSchema, cV as userAircraftRatingSchema, cW as userQualificationSchema, cY as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, a$ as courseCheckSyllabusSchema, b0 as courseEnrollmentMetricsSchema, co as mediaSchema, n as FormSubmission, bh as fboAcceptanceAxisSchema, bi as fboAcceptanceStatusSchema, bl as fboActivitySchema, bj as fboActivityCauserSchema, bk as fboActivityChangesSchema, bq as fboCompanySchema, bn as fboCompanyGrantSchema, bm as fboCompanyGrantInputSchema, bo as fboCompanyMemberSchema, bp as fboCompanyProfileSchema, bt as fboDecisionSchema, br as fboDecisionAxisSchema, bs as fboDecisionInputSchema, bv as fboDutySchema, bu as fboDutyAffectedSchema, bw as fboDutySeriesResponseSchema, bz as fboFlightSchema, by as fboFlightDocumentSchema, bA as fboFlightStatusSchema, bB as fboFlightTypeSchema, bD as fboGrantAbilitySchema, bC as fboGrantAbilityOptionSchema, bE as fboGrantCompanyRefSchema, bF as fboGroundServicesSchema, bG as fboLandingsSummarySchema, bH as fboMaterialiseResultSchema, bI as fboMetaSchema, bJ as fboNextDutySchema, bK as fboOccupationSchema, bL as fboOperationsSchema, bM as fboPersonSchema, bN as fboPobSchema, bO as fboRecurrenceSchema, bP as fboRecurrenceTypeSchema, bQ as fboRecurringFlightSchema, bR as fboRoleSchema, bT as fboStatisticsSchema, bU as fboSystemRoleSchema, bV as fboTrafficLayerInputSchema, bW as fboTrafficRowSchema, bY as fboTrafficSourceSchema, bZ as fboVisibilitySchema, b_ as fboWeeklyLandingSchema } from '../fbo-
|
|
2
|
+
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, b3 as courseSchema, b1 as courseEnrollmentSchema, b2 as courseFeeSchema, aJ as airplaneIssueSeverityEnum, b9 as documentSchema, b5 as documentComplianceStatus, b6 as documentRequirement, b7 as documentRequirementGroup, b8 as documentRequirementGroupAssignment, ba as documentShareSchema, bb as documentType, bd as eventSchema, bf as expenseSchema, be as expenseItemSchema, bg as extendedAirplaneSchema, c0 as feeSchema, b$ as feeCategoryOptionsSchema, c1 as flightLogSchema, c6 as flightRequestSchema, c2 as flightRequestAvailabilitySchema, c3 as flightRequestBusyIntervalSchema, c4 as flightRequestResponseSchema, c5 as flightRequestResponseStatusSchema, c7 as flightRequestSeatSchema, c8 as flightRequestStatusSchema, c9 as flightRequestWindowSchema, ch as invoiceSchema, cj as landingSchema, ci as landingFeeSchema, cl as maintenanceEventSchema, ck as maintenanceEventEstimationSchema, cm as maintenanceStatusSchema, cn as mediaCollection, cq as membershipSchema, cr as membershipSignupSchema, ct as postSchema, cu as postSubjectSchema, cw as prePaidPackageSchema, cx as priceSchema, cy as qualificationSchema, cz as recurringFlightSchema, cA as roleSchema, cB as runwaySchema, cC as scheduledFlightSchema, cD as settingSchema, cE as specialFlightSchema, cL as tagSchema, cM as teachingPermissionSchema, cN as ticketSchema, cX as userSchema, cV as userAircraftRatingSchema, cW as userQualificationSchema, cY as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, a$ as courseCheckSyllabusSchema, b0 as courseEnrollmentMetricsSchema, co as mediaSchema, n as FormSubmission, bh as fboAcceptanceAxisSchema, bi as fboAcceptanceStatusSchema, bl as fboActivitySchema, bj as fboActivityCauserSchema, bk as fboActivityChangesSchema, bq as fboCompanySchema, bn as fboCompanyGrantSchema, bm as fboCompanyGrantInputSchema, bo as fboCompanyMemberSchema, bp as fboCompanyProfileSchema, bt as fboDecisionSchema, br as fboDecisionAxisSchema, bs as fboDecisionInputSchema, bv as fboDutySchema, bu as fboDutyAffectedSchema, bw as fboDutySeriesResponseSchema, bz as fboFlightSchema, by as fboFlightDocumentSchema, bA as fboFlightStatusSchema, bB as fboFlightTypeSchema, bD as fboGrantAbilitySchema, bC as fboGrantAbilityOptionSchema, bE as fboGrantCompanyRefSchema, bF as fboGroundServicesSchema, bG as fboLandingsSummarySchema, bH as fboMaterialiseResultSchema, bI as fboMetaSchema, bJ as fboNextDutySchema, bK as fboOccupationSchema, bL as fboOperationsSchema, bM as fboPersonSchema, bN as fboPobSchema, bO as fboRecurrenceSchema, bP as fboRecurrenceTypeSchema, bQ as fboRecurringFlightSchema, bR as fboRoleSchema, bT as fboStatisticsSchema, bU as fboSystemRoleSchema, bV as fboTrafficLayerInputSchema, bW as fboTrafficRowSchema, bY as fboTrafficSourceSchema, bZ as fboVisibilitySchema, b_ as fboWeeklyLandingSchema } from '../fbo-TbdcUaI9.cjs';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, b3 as courseSchema, b1 as courseEnrollmentSchema, b2 as courseFeeSchema, aJ as airplaneIssueSeverityEnum, b9 as documentSchema, b5 as documentComplianceStatus, b6 as documentRequirement, b7 as documentRequirementGroup, b8 as documentRequirementGroupAssignment, ba as documentShareSchema, bb as documentType, bd as eventSchema, bf as expenseSchema, be as expenseItemSchema, bg as extendedAirplaneSchema, c0 as feeSchema, b$ as feeCategoryOptionsSchema, c1 as flightLogSchema, c6 as flightRequestSchema, c2 as flightRequestAvailabilitySchema, c3 as flightRequestBusyIntervalSchema, c4 as flightRequestResponseSchema, c5 as flightRequestResponseStatusSchema, c7 as flightRequestSeatSchema, c8 as flightRequestStatusSchema, c9 as flightRequestWindowSchema, ch as invoiceSchema, cj as landingSchema, ci as landingFeeSchema, cl as maintenanceEventSchema, ck as maintenanceEventEstimationSchema, cm as maintenanceStatusSchema, cn as mediaCollection, cq as membershipSchema, cr as membershipSignupSchema, ct as postSchema, cu as postSubjectSchema, cw as prePaidPackageSchema, cx as priceSchema, cy as qualificationSchema, cz as recurringFlightSchema, cA as roleSchema, cB as runwaySchema, cC as scheduledFlightSchema, cD as settingSchema, cE as specialFlightSchema, cL as tagSchema, cM as teachingPermissionSchema, cN as ticketSchema, cX as userSchema, cV as userAircraftRatingSchema, cW as userQualificationSchema, cY as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, a$ as courseCheckSyllabusSchema, b0 as courseEnrollmentMetricsSchema, co as mediaSchema, n as FormSubmission, bh as fboAcceptanceAxisSchema, bi as fboAcceptanceStatusSchema, bl as fboActivitySchema, bj as fboActivityCauserSchema, bk as fboActivityChangesSchema, bq as fboCompanySchema, bn as fboCompanyGrantSchema, bm as fboCompanyGrantInputSchema, bo as fboCompanyMemberSchema, bp as fboCompanyProfileSchema, bt as fboDecisionSchema, br as fboDecisionAxisSchema, bs as fboDecisionInputSchema, bv as fboDutySchema, bu as fboDutyAffectedSchema, bw as fboDutySeriesResponseSchema, bz as fboFlightSchema, by as fboFlightDocumentSchema, bA as fboFlightStatusSchema, bB as fboFlightTypeSchema, bD as fboGrantAbilitySchema, bC as fboGrantAbilityOptionSchema, bE as fboGrantCompanyRefSchema, bF as fboGroundServicesSchema, bG as fboLandingsSummarySchema, bH as fboMaterialiseResultSchema, bI as fboMetaSchema, bJ as fboNextDutySchema, bK as fboOccupationSchema, bL as fboOperationsSchema, bM as fboPersonSchema, bN as fboPobSchema, bO as fboRecurrenceSchema, bP as fboRecurrenceTypeSchema, bQ as fboRecurringFlightSchema, bR as fboRoleSchema, bT as fboStatisticsSchema, bU as fboSystemRoleSchema, bV as fboTrafficLayerInputSchema, bW as fboTrafficRowSchema, bY as fboTrafficSourceSchema, bZ as fboVisibilitySchema, b_ as fboWeeklyLandingSchema } from '../fbo-
|
|
2
|
+
import { aE as activitySchema, aF as addressSchema, aG as aircraftPositionSchema, aH as aircraftRatingSchema, aM as airplaneSchema, aL as airplanePermissionSchema, aN as airplaneShareInviteSchema, aO as airportSchema, aP as alertSchema, aQ as allowedDocumentTypeSchema, aR as approachTypeSchema, aS as availSchema, aT as baseMembershipSchema, aV as bookingSchema, aX as commentSchema, aZ as companySchema, b3 as courseSchema, b1 as courseEnrollmentSchema, b2 as courseFeeSchema, aJ as airplaneIssueSeverityEnum, b9 as documentSchema, b5 as documentComplianceStatus, b6 as documentRequirement, b7 as documentRequirementGroup, b8 as documentRequirementGroupAssignment, ba as documentShareSchema, bb as documentType, bd as eventSchema, bf as expenseSchema, be as expenseItemSchema, bg as extendedAirplaneSchema, c0 as feeSchema, b$ as feeCategoryOptionsSchema, c1 as flightLogSchema, c6 as flightRequestSchema, c2 as flightRequestAvailabilitySchema, c3 as flightRequestBusyIntervalSchema, c4 as flightRequestResponseSchema, c5 as flightRequestResponseStatusSchema, c7 as flightRequestSeatSchema, c8 as flightRequestStatusSchema, c9 as flightRequestWindowSchema, ch as invoiceSchema, cj as landingSchema, ci as landingFeeSchema, cl as maintenanceEventSchema, ck as maintenanceEventEstimationSchema, cm as maintenanceStatusSchema, cn as mediaCollection, cq as membershipSchema, cr as membershipSignupSchema, ct as postSchema, cu as postSubjectSchema, cw as prePaidPackageSchema, cx as priceSchema, cy as qualificationSchema, cz as recurringFlightSchema, cA as roleSchema, cB as runwaySchema, cC as scheduledFlightSchema, cD as settingSchema, cE as specialFlightSchema, cL as tagSchema, cM as teachingPermissionSchema, cN as ticketSchema, cX as userSchema, cV as userAircraftRatingSchema, cW as userQualificationSchema, cY as waypointSchema, aI as airplaneIssueSchema, aK as airplaneIssueStatusEnum, B as BaseModel$1, a$ as courseCheckSyllabusSchema, b0 as courseEnrollmentMetricsSchema, co as mediaSchema, n as FormSubmission, bh as fboAcceptanceAxisSchema, bi as fboAcceptanceStatusSchema, bl as fboActivitySchema, bj as fboActivityCauserSchema, bk as fboActivityChangesSchema, bq as fboCompanySchema, bn as fboCompanyGrantSchema, bm as fboCompanyGrantInputSchema, bo as fboCompanyMemberSchema, bp as fboCompanyProfileSchema, bt as fboDecisionSchema, br as fboDecisionAxisSchema, bs as fboDecisionInputSchema, bv as fboDutySchema, bu as fboDutyAffectedSchema, bw as fboDutySeriesResponseSchema, bz as fboFlightSchema, by as fboFlightDocumentSchema, bA as fboFlightStatusSchema, bB as fboFlightTypeSchema, bD as fboGrantAbilitySchema, bC as fboGrantAbilityOptionSchema, bE as fboGrantCompanyRefSchema, bF as fboGroundServicesSchema, bG as fboLandingsSummarySchema, bH as fboMaterialiseResultSchema, bI as fboMetaSchema, bJ as fboNextDutySchema, bK as fboOccupationSchema, bL as fboOperationsSchema, bM as fboPersonSchema, bN as fboPobSchema, bO as fboRecurrenceSchema, bP as fboRecurrenceTypeSchema, bQ as fboRecurringFlightSchema, bR as fboRoleSchema, bT as fboStatisticsSchema, bU as fboSystemRoleSchema, bV as fboTrafficLayerInputSchema, bW as fboTrafficRowSchema, bY as fboTrafficSourceSchema, bZ as fboVisibilitySchema, b_ as fboWeeklyLandingSchema } from '../fbo-TbdcUaI9.js';
|
|
3
3
|
|
|
4
4
|
type BaseModel = z.infer<typeof BaseModel$1>;
|
|
5
5
|
type User = z.infer<typeof userSchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updraft-solutions/mcrit-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Shared TypeScript types, Zod schemas, and pure helpers for the MCRIT aviation fleet management platform",
|
|
5
5
|
"homepage": "https://github.com/updraft-solutions/mcrit-sdk#readme",
|
|
6
6
|
"bugs": {
|
package/src/schemas/index.ts
CHANGED
package/src/schemas/models.ts
CHANGED
|
@@ -390,7 +390,7 @@ export const flightRequestResponseSchema = z.object({
|
|
|
390
390
|
membership: membershipIdentitySchema.optional(),
|
|
391
391
|
role: z.string(),
|
|
392
392
|
airplane_id: z.number().nullable(),
|
|
393
|
-
airplane: z.object({ id: z.number(), registration: z.string() }).nullable().optional(),
|
|
393
|
+
airplane: z.object({ id: z.number(), registration: z.string(), homebase_id: z.number().nullable().optional() }).nullable().optional(),
|
|
394
394
|
etdZ: z.string().nullable(),
|
|
395
395
|
etaZ: z.string().nullable(),
|
|
396
396
|
message: z.string().nullable(),
|
|
@@ -425,7 +425,7 @@ export const flightRequestSchema = z.object({
|
|
|
425
425
|
published_at: z.string().nullable(),
|
|
426
426
|
closed_at: z.string().nullable(),
|
|
427
427
|
windows: z.array(flightRequestWindowSchema),
|
|
428
|
-
airplanes: z.array(z.object({ id: z.number(), registration: z.string(), model: z.string().nullable() })),
|
|
428
|
+
airplanes: z.array(z.object({ id: z.number(), registration: z.string(), model: z.string().nullable(), homebase_id: z.number().nullable().optional() })),
|
|
429
429
|
seats: z.array(flightRequestSeatSchema),
|
|
430
430
|
pending_responses_count: z.number(),
|
|
431
431
|
my_response: flightRequestResponseSchema.nullable(),
|
|
@@ -435,6 +435,7 @@ export const flightRequestSchema = z.object({
|
|
|
435
435
|
id: z.number(),
|
|
436
436
|
airplane_id: z.number(),
|
|
437
437
|
registration: z.string().nullable(),
|
|
438
|
+
homebase_id: z.number().nullable().optional(),
|
|
438
439
|
etdZ: z.string().nullable(),
|
|
439
440
|
etaZ: z.string().nullable(),
|
|
440
441
|
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { FormSubmissionSource } from "./form-template";
|
|
3
|
+
import {
|
|
4
|
+
CompanySystemContractsResponseSchema,
|
|
5
|
+
SystemContractRegisterResponseSchema,
|
|
6
|
+
} from "./system-contract";
|
|
7
|
+
import { TodoSchema } from "./todo";
|
|
8
|
+
|
|
9
|
+
describe("system contract schemas", () => {
|
|
10
|
+
it("parses the super-admin register", () => {
|
|
11
|
+
const parsed = SystemContractRegisterResponseSchema.parse({
|
|
12
|
+
data: [{
|
|
13
|
+
slug: "sys-contract-avv",
|
|
14
|
+
name: "Vertrag zur Auftragsverarbeitung (AVV)",
|
|
15
|
+
current_version: 2,
|
|
16
|
+
companies: [
|
|
17
|
+
{ company_id: 1, company_name: "A", state: "open", signed_version: 1, due_date: "2026-10-17", signed_at: null, signed_by: null, submission_id: 9 },
|
|
18
|
+
{ company_id: 2, company_name: "B", state: "not_issued", signed_version: null, due_date: null, signed_at: null, signed_by: null, submission_id: null },
|
|
19
|
+
],
|
|
20
|
+
}],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
expect(parsed.data[0].companies[0].state).toBe("open");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("rejects an unknown register state", () => {
|
|
27
|
+
expect(() => SystemContractRegisterResponseSchema.parse({
|
|
28
|
+
data: [{ slug: "s", name: "n", current_version: 1, companies: [
|
|
29
|
+
{ company_id: 1, company_name: "A", state: "lost", signed_version: null, due_date: null, signed_at: null, signed_by: null, submission_id: null },
|
|
30
|
+
] }],
|
|
31
|
+
})).toThrow();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("parses the company list envelope with its current versions", () => {
|
|
35
|
+
const parsed = CompanySystemContractsResponseSchema.parse({ data: [], meta: { current_versions: { "41": 2 } } });
|
|
36
|
+
|
|
37
|
+
expect(parsed.meta.current_versions["41"]).toBe(2);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe("todo + source enums", () => {
|
|
42
|
+
it("accepts the critical priority and the ticket todo", () => {
|
|
43
|
+
const todo = TodoSchema.parse({
|
|
44
|
+
key: "handle_ticket", ref_type: "ticket", ref_id: 1, title: "t", priority: "critical",
|
|
45
|
+
action: { type: "navigate", target: "/" },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
expect(todo.priority).toBe("critical");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("knows the system_contract submission source", () => {
|
|
52
|
+
expect(FormSubmissionSource.SystemContract).toBe("system_contract");
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { FormSubmissionSchema } from "./form-template";
|
|
3
|
+
|
|
4
|
+
/** State of a company for the CURRENT version of a system contract. */
|
|
5
|
+
export const SystemContractStateSchema = z.enum(["signed", "open", "overdue", "not_issued"]);
|
|
6
|
+
export type SystemContractState = z.infer<typeof SystemContractStateSchema>;
|
|
7
|
+
|
|
8
|
+
export const SystemContractRegisterRowSchema = z.object({
|
|
9
|
+
company_id: z.number(),
|
|
10
|
+
company_name: z.string(),
|
|
11
|
+
state: SystemContractStateSchema,
|
|
12
|
+
/** Highest version this company ever signed — may be older than the current one. */
|
|
13
|
+
signed_version: z.number().nullable(),
|
|
14
|
+
due_date: z.string().nullable(),
|
|
15
|
+
signed_at: z.string().nullable(),
|
|
16
|
+
signed_by: z.string().nullable(),
|
|
17
|
+
submission_id: z.number().nullable(),
|
|
18
|
+
});
|
|
19
|
+
export type SystemContractRegisterRow = z.infer<typeof SystemContractRegisterRowSchema>;
|
|
20
|
+
|
|
21
|
+
export const SystemContractRegisterEntrySchema = z.object({
|
|
22
|
+
slug: z.string(),
|
|
23
|
+
name: z.string(),
|
|
24
|
+
current_version: z.number(),
|
|
25
|
+
companies: z.array(SystemContractRegisterRowSchema),
|
|
26
|
+
});
|
|
27
|
+
export type SystemContractRegisterEntry = z.infer<typeof SystemContractRegisterEntrySchema>;
|
|
28
|
+
|
|
29
|
+
export const SystemContractRegisterResponseSchema = z.object({
|
|
30
|
+
data: z.array(SystemContractRegisterEntrySchema),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const CompanySystemContractsResponseSchema = z.object({
|
|
34
|
+
data: z.array(FormSubmissionSchema),
|
|
35
|
+
meta: z.object({ current_versions: z.record(z.string(), z.number()) }),
|
|
36
|
+
});
|
|
37
|
+
export type CompanySystemContractsResponse = z.infer<typeof CompanySystemContractsResponseSchema>;
|
package/src/schemas/todo.ts
CHANGED
|
@@ -16,8 +16,12 @@ export const TodoKey = z.enum([
|
|
|
16
16
|
"share_document",
|
|
17
17
|
"fill_training_record",
|
|
18
18
|
"sign_training_record",
|
|
19
|
+
"handle_ticket",
|
|
19
20
|
]);
|
|
20
21
|
|
|
22
|
+
export const TodoPrioritySchema = z.enum(["critical", "high", "normal", "low"]);
|
|
23
|
+
export type TodoPriority = z.infer<typeof TodoPrioritySchema>;
|
|
24
|
+
|
|
21
25
|
export const TodoSchema = z.object({
|
|
22
26
|
key: TodoKey,
|
|
23
27
|
ref_type: z.string(),
|
|
@@ -26,7 +30,7 @@ export const TodoSchema = z.object({
|
|
|
26
30
|
subtitle: z.string().nullable().optional(),
|
|
27
31
|
due_date: z.string().nullable().optional(),
|
|
28
32
|
is_overdue: z.boolean().default(false),
|
|
29
|
-
priority:
|
|
33
|
+
priority: TodoPrioritySchema.default("normal"),
|
|
30
34
|
company_id: z.number().nullable().optional(),
|
|
31
35
|
action: TodoActionSchema,
|
|
32
36
|
meta: z.record(z.any()).optional(),
|