@taiger-common/model 1.0.58 → 1.0.59
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/cjs/api/account.js +35 -0
- package/dist/cjs/api/applications.js +46 -0
- package/dist/cjs/api/audit.js +8 -0
- package/dist/cjs/api/auth.js +19 -0
- package/dist/cjs/api/common.js +32 -0
- package/dist/cjs/api/communications.js +15 -0
- package/dist/cjs/api/courses.js +23 -0
- package/dist/cjs/api/crm.js +87 -0
- package/dist/cjs/api/documentThreads.js +44 -0
- package/dist/cjs/api/documentations.js +33 -0
- package/dist/cjs/api/events.js +22 -0
- package/dist/cjs/api/index.js +41 -0
- package/dist/cjs/api/interviews.js +35 -0
- package/dist/cjs/api/meetings.js +20 -0
- package/dist/cjs/api/notes.js +8 -0
- package/dist/cjs/api/permissions.js +9 -0
- package/dist/cjs/api/portals.js +24 -0
- package/dist/cjs/api/programRequirements.js +26 -0
- package/dist/cjs/api/programs.js +93 -0
- package/dist/cjs/api/search.js +24 -0
- package/dist/cjs/api/serialized.js +50 -0
- package/dist/cjs/api/students.js +29 -0
- package/dist/cjs/api/teams.js +48 -0
- package/dist/cjs/api/tickets.js +21 -0
- package/dist/cjs/api/users.js +42 -0
- package/dist/cjs/api/widgets.js +21 -0
- package/dist/cjs/constants/users.js +12 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/model/Application.js +78 -0
- package/dist/cjs/model/Documentthread.js +2 -4
- package/dist/cjs/model/Program.js +331 -83
- package/dist/cjs/model/User.js +79 -139
- package/dist/cjs/model/index.js +1 -1
- package/dist/cjs/schema/index.js +22 -0
- package/dist/cjs/schema/models.js +523 -0
- package/dist/cjs/schema/serialized.js +202 -0
- package/package.json +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.BasedocumentationslinkWithIdSchema = exports.TemplateWithIdSchema = exports.SurveyInputWithIdSchema = exports.KeywordsetWithIdSchema = exports.AllCourseWithIdSchema = exports.ProgramrequirementWithIdSchema = exports.InternaldocWithIdSchema = exports.DocspageWithIdSchema = exports.DocumentationWithIdSchema = exports.PermissionWithIdSchema = exports.NoteWithIdSchema = exports.EventWithIdSchema = exports.AuditWithIdSchema = exports.ComplaintWithIdSchema = exports.TicketWithIdSchema = exports.InterviewSurveyResponseWithIdSchema = exports.InterviewWithIdSchema = exports.CommunicationWithIdSchema = exports.DocumentthreadPopulatedSchema = exports.DocumentthreadWithIdSchema = exports.UserWithIdSchema = exports.StudentResponseSchema = exports.ApplicationPopulatedSchema = exports.ApplicationWithIdSchema = exports.EditorWithIdSchema = exports.AgentWithIdSchema = exports.ProgramWithIdSchema = void 0;
|
|
15
|
+
/**
|
|
16
|
+
* Zod schemas for API-serialized model types (all ObjectId refs as strings).
|
|
17
|
+
* Types are inferred from schemas via z.infer<>.
|
|
18
|
+
* Circular references (IStudentResponse <-> IApplicationPopulated) are handled with z.lazy().
|
|
19
|
+
*/
|
|
20
|
+
var zod_1 = require("zod");
|
|
21
|
+
var models_1 = require("./models");
|
|
22
|
+
// =========== Program with _id ===========
|
|
23
|
+
exports.ProgramWithIdSchema = models_1.ProgramSchema.extend({
|
|
24
|
+
_id: zod_1.z.string(),
|
|
25
|
+
vcId: zod_1.z.string().optional()
|
|
26
|
+
});
|
|
27
|
+
// =========== Agent/Editor with _id ===========
|
|
28
|
+
var officehoursDaySchema = zod_1.z.object({
|
|
29
|
+
active: zod_1.z.boolean().optional(),
|
|
30
|
+
time_slots: zod_1.z.array(zod_1.z.unknown()).optional()
|
|
31
|
+
});
|
|
32
|
+
var agentNotificationSchema = zod_1.z.object({
|
|
33
|
+
isRead_new_base_docs_uploaded: zod_1.z
|
|
34
|
+
.array(zod_1.z.object({
|
|
35
|
+
student_id: zod_1.z.string().optional(),
|
|
36
|
+
student_firstname: zod_1.z.string().optional(),
|
|
37
|
+
student_lastname: zod_1.z.string().optional()
|
|
38
|
+
}))
|
|
39
|
+
.optional(),
|
|
40
|
+
isRead_new_survey_updated: zod_1.z.boolean().optional(),
|
|
41
|
+
isRead_applications_status_changed: zod_1.z.boolean().optional(),
|
|
42
|
+
isRead_new_programs_assigned: zod_1.z.boolean().optional()
|
|
43
|
+
});
|
|
44
|
+
var editorAttributeSchema = zod_1.z.object({
|
|
45
|
+
can_write_ml: zod_1.z.boolean().optional(),
|
|
46
|
+
can_write_rl: zod_1.z.boolean().optional(),
|
|
47
|
+
can_write_cv: zod_1.z.boolean().optional(),
|
|
48
|
+
can_write_essay: zod_1.z.boolean().optional(),
|
|
49
|
+
can_do_interview: zod_1.z.boolean().optional()
|
|
50
|
+
});
|
|
51
|
+
var editorNotificationSchema = zod_1.z.object({
|
|
52
|
+
isRead_survey_not_complete: zod_1.z.boolean().optional(),
|
|
53
|
+
isRead_base_documents_missing: zod_1.z.boolean().optional(),
|
|
54
|
+
isRead_base_documents_rejected: zod_1.z.boolean().optional(),
|
|
55
|
+
isRead_new_programs_assigned: zod_1.z.boolean().optional()
|
|
56
|
+
});
|
|
57
|
+
/** Shared base user fields (API-safe, no Mongoose types) */
|
|
58
|
+
var userBaseFields = {
|
|
59
|
+
_id: zod_1.z.string(),
|
|
60
|
+
role: zod_1.z.string().optional(),
|
|
61
|
+
firstname: zod_1.z.string().optional(),
|
|
62
|
+
firstname_chinese: zod_1.z.string().optional(),
|
|
63
|
+
lastname: zod_1.z.string().optional(),
|
|
64
|
+
lastname_chinese: zod_1.z.string().optional(),
|
|
65
|
+
email: zod_1.z.string().optional(),
|
|
66
|
+
pictureUrl: zod_1.z.string().optional(),
|
|
67
|
+
archiv: zod_1.z.boolean().optional(),
|
|
68
|
+
birthday: zod_1.z.string().optional(),
|
|
69
|
+
linkedIn: zod_1.z.string().optional(),
|
|
70
|
+
lineId: zod_1.z.string().optional(),
|
|
71
|
+
timezone: zod_1.z.string().optional(),
|
|
72
|
+
isAccountActivated: zod_1.z.boolean().optional(),
|
|
73
|
+
notification: models_1.UserNotificationSchema.optional(),
|
|
74
|
+
taigerai: models_1.UserTaigeraiSchema.optional(),
|
|
75
|
+
application_preference: models_1.UserApplicationPreferenceSchema.optional(),
|
|
76
|
+
academic_background: models_1.UserAcademicBackgroundSchema.optional(),
|
|
77
|
+
lastLoginAt: zod_1.z.coerce.date().optional(),
|
|
78
|
+
needEditor: zod_1.z.boolean().optional(),
|
|
79
|
+
applying_program_count: zod_1.z.number().optional(),
|
|
80
|
+
attributes: zod_1.z.array(models_1.UserAttributeSchema).optional(),
|
|
81
|
+
profile: zod_1.z.array(models_1.UserProfileItemSchema).optional(),
|
|
82
|
+
courses: models_1.CourseSchema.optional()
|
|
83
|
+
};
|
|
84
|
+
exports.AgentWithIdSchema = zod_1.z.object(__assign(__assign({}, userBaseFields), { officehours: zod_1.z.record(officehoursDaySchema).optional(), selfIntroduction: zod_1.z.string().optional(), agent_notification: agentNotificationSchema.optional() }));
|
|
85
|
+
exports.EditorWithIdSchema = zod_1.z.object(__assign(__assign({}, userBaseFields), { officehours: zod_1.z.record(officehoursDaySchema).optional(), editor_notification: editorNotificationSchema.optional(), attribute: editorAttributeSchema.optional() }));
|
|
86
|
+
/** Application response with string _id and unpopulated refs */
|
|
87
|
+
exports.ApplicationWithIdSchema = zod_1.z.object({
|
|
88
|
+
_id: zod_1.z.string(),
|
|
89
|
+
programId: zod_1.z.string().optional(),
|
|
90
|
+
studentId: zod_1.z.string().optional(),
|
|
91
|
+
uni_assist: models_1.ApplicationUniAssistSchema.optional(),
|
|
92
|
+
portal_credentials: models_1.ApplicationPortalCredentialsSchema.optional(),
|
|
93
|
+
doc_modification_thread: zod_1.z.array(models_1.ApplicationDocModificationThreadItemSchema).optional(),
|
|
94
|
+
reject_reason: zod_1.z.string().optional(),
|
|
95
|
+
admission_letter: models_1.ApplicationAdmissionLetterSchema.optional(),
|
|
96
|
+
finalEnrolment: zod_1.z.boolean().optional(),
|
|
97
|
+
decided: zod_1.z.string().optional(),
|
|
98
|
+
closed: zod_1.z.string().optional(),
|
|
99
|
+
admission: zod_1.z.string().optional(),
|
|
100
|
+
application_year: zod_1.z.string().optional(),
|
|
101
|
+
isLocked: zod_1.z.boolean().optional(),
|
|
102
|
+
credential_a_filled: zod_1.z.boolean().optional(),
|
|
103
|
+
credential_b_filled: zod_1.z.boolean().optional()
|
|
104
|
+
});
|
|
105
|
+
/** Application with populated programId and studentId — uses z.lazy for circular ref */
|
|
106
|
+
exports.ApplicationPopulatedSchema = zod_1.z.lazy(function () {
|
|
107
|
+
return zod_1.z.object({
|
|
108
|
+
_id: zod_1.z.string(),
|
|
109
|
+
programId: exports.ProgramWithIdSchema.optional(),
|
|
110
|
+
studentId: exports.StudentResponseSchema.optional(),
|
|
111
|
+
uni_assist: models_1.ApplicationUniAssistSchema.optional(),
|
|
112
|
+
portal_credentials: models_1.ApplicationPortalCredentialsSchema.optional(),
|
|
113
|
+
doc_modification_thread: zod_1.z.array(models_1.ApplicationDocModificationThreadItemSchema).optional(),
|
|
114
|
+
reject_reason: zod_1.z.string().optional(),
|
|
115
|
+
admission_letter: models_1.ApplicationAdmissionLetterSchema.optional(),
|
|
116
|
+
finalEnrolment: zod_1.z.boolean().optional(),
|
|
117
|
+
decided: zod_1.z.string().optional(),
|
|
118
|
+
closed: zod_1.z.string().optional(),
|
|
119
|
+
admission: zod_1.z.string().optional(),
|
|
120
|
+
application_year: zod_1.z.string().optional(),
|
|
121
|
+
isLocked: zod_1.z.boolean().optional(),
|
|
122
|
+
credential_a_filled: zod_1.z.boolean().optional(),
|
|
123
|
+
credential_b_filled: zod_1.z.boolean().optional()
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
/** Student response with populated agents, editors, applications — uses z.lazy for circular ref */
|
|
127
|
+
exports.StudentResponseSchema = zod_1.z.lazy(function () {
|
|
128
|
+
return zod_1.z.object(__assign(__assign({}, userBaseFields), { generaldocs_threads: zod_1.z.array(models_1.UserGeneraldocsThreadSchema).optional(), applications: zod_1.z.array(exports.ApplicationPopulatedSchema).optional(), agents: zod_1.z.array(exports.AgentWithIdSchema).optional(), editors: zod_1.z.array(exports.EditorWithIdSchema).optional() }));
|
|
129
|
+
});
|
|
130
|
+
/** Frontend-friendly User/Student with string _id (no nested ObjectId refs) */
|
|
131
|
+
exports.UserWithIdSchema = zod_1.z.object(__assign(__assign({}, userBaseFields), { generaldocs_threads: zod_1.z.array(models_1.UserGeneraldocsThreadSchema).optional() }));
|
|
132
|
+
// =========== Document thread with _id ===========
|
|
133
|
+
exports.DocumentthreadWithIdSchema = zod_1.z.object({
|
|
134
|
+
_id: zod_1.z.string(),
|
|
135
|
+
student_id: zod_1.z.string(),
|
|
136
|
+
program_id: zod_1.z.string().optional(),
|
|
137
|
+
application_id: zod_1.z.string().optional(),
|
|
138
|
+
outsourced_user_id: zod_1.z.array(zod_1.z.string()).optional(),
|
|
139
|
+
pin_by_user_id: zod_1.z.array(zod_1.z.string()).optional(),
|
|
140
|
+
flag_by_user_id: zod_1.z.array(zod_1.z.string()).optional(),
|
|
141
|
+
file_type: zod_1.z.string(),
|
|
142
|
+
isFinalVersion: zod_1.z.boolean().optional(),
|
|
143
|
+
isOriginAuthorDeclarationConfirmedByStudent: zod_1.z.boolean().optional(),
|
|
144
|
+
isOriginAuthorDeclarationConfirmedByStudentTimestamp: zod_1.z.coerce.date().optional(),
|
|
145
|
+
messages: zod_1.z.array(models_1.DocumentthreadMessageSchema).optional(),
|
|
146
|
+
essayReviewerIds: zod_1.z.array(zod_1.z.string()).optional(),
|
|
147
|
+
updatedAt: zod_1.z.coerce.date().optional()
|
|
148
|
+
});
|
|
149
|
+
/** Document thread with populated refs — student_id can be object or string */
|
|
150
|
+
exports.DocumentthreadPopulatedSchema = zod_1.z.object({
|
|
151
|
+
_id: zod_1.z.string(),
|
|
152
|
+
student_id: zod_1.z.union([exports.StudentResponseSchema, zod_1.z.string()]),
|
|
153
|
+
program_id: zod_1.z.union([exports.ProgramWithIdSchema, zod_1.z.string()]).optional(),
|
|
154
|
+
application_id: zod_1.z.union([exports.ApplicationPopulatedSchema, zod_1.z.string()]).optional(),
|
|
155
|
+
outsourced_user_id: zod_1.z.array(exports.UserWithIdSchema).optional(),
|
|
156
|
+
pin_by_user_id: zod_1.z.array(exports.UserWithIdSchema).optional(),
|
|
157
|
+
flag_by_user_id: zod_1.z.array(exports.UserWithIdSchema).optional(),
|
|
158
|
+
essayReviewerIds: zod_1.z.array(exports.UserWithIdSchema).optional(),
|
|
159
|
+
file_type: zod_1.z.string(),
|
|
160
|
+
isFinalVersion: zod_1.z.boolean().optional(),
|
|
161
|
+
isOriginAuthorDeclarationConfirmedByStudent: zod_1.z.boolean().optional(),
|
|
162
|
+
isOriginAuthorDeclarationConfirmedByStudentTimestamp: zod_1.z.coerce.date().optional(),
|
|
163
|
+
messages: zod_1.z.array(models_1.DocumentthreadMessageSchema).optional(),
|
|
164
|
+
updatedAt: zod_1.z.coerce.date().optional()
|
|
165
|
+
});
|
|
166
|
+
// =========== Simple WithId types ===========
|
|
167
|
+
exports.CommunicationWithIdSchema = models_1.CommunicationSchema.extend({ _id: zod_1.z.string() });
|
|
168
|
+
exports.InterviewWithIdSchema = models_1.InterviewSchema.extend({ _id: zod_1.z.string() });
|
|
169
|
+
exports.InterviewSurveyResponseWithIdSchema = models_1.InterviewSurveyResponseSchema.extend({
|
|
170
|
+
_id: zod_1.z.string()
|
|
171
|
+
});
|
|
172
|
+
exports.TicketWithIdSchema = models_1.TicketSchema.extend({
|
|
173
|
+
_id: zod_1.z.string(),
|
|
174
|
+
createdAt: zod_1.z.coerce.date().optional()
|
|
175
|
+
});
|
|
176
|
+
exports.ComplaintWithIdSchema = models_1.ComplaintSchema.extend({
|
|
177
|
+
_id: zod_1.z.string(),
|
|
178
|
+
createdAt: zod_1.z.coerce.date().optional()
|
|
179
|
+
});
|
|
180
|
+
exports.AuditWithIdSchema = models_1.AuditSchema.extend({
|
|
181
|
+
_id: zod_1.z.string(),
|
|
182
|
+
createdAt: zod_1.z.coerce.date().optional()
|
|
183
|
+
});
|
|
184
|
+
exports.EventWithIdSchema = models_1.EventBaseSchema.extend({
|
|
185
|
+
_id: zod_1.z.string(),
|
|
186
|
+
createdAt: zod_1.z.coerce.date().optional()
|
|
187
|
+
});
|
|
188
|
+
exports.NoteWithIdSchema = models_1.NoteSchema.extend({ _id: zod_1.z.string() });
|
|
189
|
+
exports.PermissionWithIdSchema = models_1.PermissionSchema.extend({ _id: zod_1.z.string() });
|
|
190
|
+
exports.DocumentationWithIdSchema = models_1.DocumentationSchema.extend({ _id: zod_1.z.string() });
|
|
191
|
+
exports.DocspageWithIdSchema = models_1.DocspageSchema.extend({ _id: zod_1.z.string() });
|
|
192
|
+
exports.InternaldocWithIdSchema = models_1.InternaldocSchema.extend({ _id: zod_1.z.string() });
|
|
193
|
+
exports.ProgramrequirementWithIdSchema = models_1.ProgramrequirementSchema.extend({
|
|
194
|
+
_id: zod_1.z.string()
|
|
195
|
+
});
|
|
196
|
+
exports.AllCourseWithIdSchema = models_1.AllCourseSchema.extend({ _id: zod_1.z.string() });
|
|
197
|
+
exports.KeywordsetWithIdSchema = models_1.KeywordsetSchema.extend({ _id: zod_1.z.string() });
|
|
198
|
+
exports.SurveyInputWithIdSchema = models_1.SurveyInputSchema.extend({ _id: zod_1.z.string() });
|
|
199
|
+
exports.TemplateWithIdSchema = models_1.TemplateSchema.extend({ _id: zod_1.z.string() });
|
|
200
|
+
exports.BasedocumentationslinkWithIdSchema = models_1.BasedocumentationslinkSchema.extend({
|
|
201
|
+
_id: zod_1.z.string()
|
|
202
|
+
});
|