@thejob/schema 1.0.35 → 1.0.37

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.
@@ -87,54 +87,63 @@ const ResumeLanguageSectionSchema = reach(UserSchema, "languages");
87
87
  * ResumeSchemaV2 is a lazy schema that dynamically loads the appropriate schema based on the section type.
88
88
  */
89
89
  }
90
- export const ResumeSchemaV2 = array()
91
- .of(lazy((section) => {
92
- const { id } = section;
93
- return object({
94
- id: string()
95
- .oneOf(SupportedResumeSectionTypes)
96
- .required()
97
- .label("Section"),
98
- data: lazy(() => {
99
- switch (id) {
100
- case ResumeSectionType.GeneralInfo:
101
- // GeneralInfo schema is a single object schema, use it directly with null default
102
- return ResumeGeneralInfoSectionSchema.nullable().default(null);
103
- case ResumeSectionType.WorkExperience:
104
- // WorkExperience schema is already an array schema, use it directly with empty array default
105
- return ResumeWorkExperienceSectionSchema.default([]);
106
- case ResumeSectionType.Education:
107
- // Education schema is already an array schema, use it directly with empty array default
108
- return ResumeEducationSectionSchema.default([]);
109
- case ResumeSectionType.Skill:
110
- // Skill schema is already an array schema, use it directly with empty array default
111
- return ResumeSkillSectionSchema.default([]);
112
- case ResumeSectionType.Project:
113
- // Project schema is already an array schema, use it directly with empty array default
114
- return ResumeProjectSectionSchema.default([]);
115
- case ResumeSectionType.Certification:
116
- // Certification schema is already an array schema, use it directly with empty array default
117
- return ResumeCertificationSectionSchema.default([]);
118
- case ResumeSectionType.Interest:
119
- // Interest schema is already an array schema, use it directly with empty array default
120
- return ResumeInterestSectionSchema.default([]);
121
- case ResumeSectionType.Language:
122
- // Language schema is already an array schema, use it directly with empty array default
123
- return ResumeLanguageSectionSchema.default([]);
124
- // case ResumeSectionType.AdditionalInfo:
125
- // // AdditionalInfo schema is already an array schema, use it directly with empty array default
126
- // return ResumeAdditionalInfoSectionSchema.default([]);
127
- // case ResumeSectionType.Reference:
128
- // return array().of(ResumeReferenceSectionSchema).required().label("Data");
129
- default:
130
- throw new ValidationError(`Invalid Section Type: ${id}`);
131
- }
132
- }),
133
- });
134
- }))
135
- .required()
136
- .default([])
137
- .label("Resume Schema V2");
90
+ export const ResumeSchemaV2 = object()
91
+ .shape({
92
+ userId: string().objectId().required().label("User ID"),
93
+ slug: string().required().label("Slug"),
94
+ sections: array()
95
+ .of(lazy((section) => {
96
+ const { id } = section;
97
+ return object({
98
+ id: string()
99
+ .oneOf(SupportedResumeSectionTypes)
100
+ .required()
101
+ .label("Section"),
102
+ data: lazy(() => {
103
+ switch (id) {
104
+ case ResumeSectionType.GeneralInfo:
105
+ // GeneralInfo schema is a single object schema, use it directly with null default
106
+ return ResumeGeneralInfoSectionSchema.nullable().default(null);
107
+ case ResumeSectionType.WorkExperience:
108
+ // WorkExperience schema is already an array schema, use it directly with empty array default
109
+ return ResumeWorkExperienceSectionSchema.default([]);
110
+ case ResumeSectionType.Education:
111
+ // Education schema is already an array schema, use it directly with empty array default
112
+ return ResumeEducationSectionSchema.default([]);
113
+ case ResumeSectionType.Skill:
114
+ // Skill schema is already an array schema, use it directly with empty array default
115
+ return ResumeSkillSectionSchema.default([]);
116
+ case ResumeSectionType.Project:
117
+ // Project schema is already an array schema, use it directly with empty array default
118
+ return ResumeProjectSectionSchema.default([]);
119
+ case ResumeSectionType.Certification:
120
+ // Certification schema is already an array schema, use it directly with empty array default
121
+ return ResumeCertificationSectionSchema.default([]);
122
+ case ResumeSectionType.Interest:
123
+ // Interest schema is already an array schema, use it directly with empty array default
124
+ return ResumeInterestSectionSchema.default([]);
125
+ case ResumeSectionType.Language:
126
+ // Language schema is already an array schema, use it directly with empty array default
127
+ return ResumeLanguageSectionSchema.default([]);
128
+ // case ResumeSectionType.AdditionalInfo:
129
+ // // AdditionalInfo schema is already an array schema, use it directly with empty array default
130
+ // return ResumeAdditionalInfoSectionSchema.default([]);
131
+ // case ResumeSectionType.Reference:
132
+ // return array().of(ResumeReferenceSectionSchema).required().label("Data");
133
+ default:
134
+ throw new ValidationError(`Invalid Section Type: ${id}`);
135
+ }
136
+ }),
137
+ });
138
+ }))
139
+ .required()
140
+ .default([])
141
+ .label("Resume sections"),
142
+ })
143
+ .concat(DbDefaultSchema)
144
+ .noUnknown()
145
+ .strict()
146
+ .label("Resume V2 Schema");
138
147
  // export type TResumeSectionMap = {
139
148
  // [ResumeSectionType.GeneralInfo]: TResumeGeneralInfoSectionSchema;
140
149
  // [ResumeSectionType.WorkExperience]: TResumeWorkExperienceSectionSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thejob/schema",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",