@thejob/schema 1.0.35 → 1.0.38

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