fix: create separate types for work and education

Create separate types for education and employment to fix the issue
where unnecessary fields are created under both education and employment
when a new CV is created.
This commit is contained in:
Dan Anglin 2023-08-19 00:29:55 +01:00
parent 9e0f5af2e6
commit 8a530551c2
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
4 changed files with 96 additions and 40 deletions

View file

@ -17,12 +17,12 @@ A short written summary of your skills, achievements and experiences in relation
|Your contact information. You can use any key/value pairs here.
|education
|list(<<Experience>>)
|list(<<Education>>)
|A list of your education experiences.
|employment
|list(<<Experience>>)
|A list of your work experiences.
|list(<<Employment>>)
|A list of your employment history.
|firstName
|string
@ -95,7 +95,36 @@ A short written summary of your skills, achievements and experiences in relation
|The start date of the experience.
|===
=== Experience
=== Education
[%header,cols=3*]
|===
|Field
|Type
|Description
|details
|list(string)
|Further details of the experience.
|duration
|<<Duration>>
|The duration of the experience.
|location
|string
|The location where the experience was based.
|qualification
|string
|The qualifications gained from this educational experience.
|school
|string
|The school or university where you have studied.
|===
=== Employment
[%header,cols=3*]
|===
@ -126,14 +155,6 @@ A short written summary of your skills, achievements and experiences in relation
|locationType
|string
|The location type of your work experience (e.g. Remote, Hybrid, On-site).
|qualification
|string
|The qualifications gained from this educational experience.
|school
|string
|The school or university where you have studied.
|===
=== Skills

View file

@ -62,7 +62,7 @@ func (c *CreateCommand) Run() error {
},
}
data.Employment = []cv.Experience{
data.Employment = []cv.Employment{
{
Company: "",
Location: "",
@ -85,7 +85,7 @@ func (c *CreateCommand) Run() error {
},
}
data.Education = []cv.Experience{
data.Education = []cv.Education{
{
School: "",
Location: "",

View file

@ -6,8 +6,8 @@ DO NOT EDIT.
*/
type CV struct {
Contact map[string]string `json:"contact,omitempty"`
Education []Experience `json:"education"`
Employment []Experience `json:"employment"`
Education []Education `json:"education"`
Employment []Employment `json:"employment"`
FirstName string `json:"firstName"`
Interests []string `json:"interests"`
JobTitle string `json:"jobTitle"`
@ -29,15 +29,21 @@ type Duration struct {
Start Date `json:"start"`
}
type Experience struct {
Company string `json:"company,omitempty"`
type Education struct {
Details []string `json:"details,omitempty"`
Duration Duration `json:"duration"`
JobTitle string `json:"jobTitle,omitempty"`
Location string `json:"location"`
LocationType string `json:"locationType,omitempty"`
Qualification string `json:"qualification,omitempty"`
School string `json:"school,omitempty"`
Qualification string `json:"qualification"`
School string `json:"school"`
}
type Employment struct {
Company string `json:"company"`
Details []string `json:"details,omitempty"`
Duration Duration `json:"duration"`
JobTitle string `json:"jobTitle"`
Location string `json:"location"`
LocationType string `json:"locationType,omitempty"`
}
type Skills struct {

View file

@ -43,13 +43,13 @@
"type": "array"
},
"employment": {
"description": "A list of your work experiences.",
"items": { "$ref": "#/$defs/experience" },
"description": "A list of your employment history.",
"items": { "$ref": "#/$defs/employment" },
"type": "array"
},
"education": {
"description": "A list of your education experiences.",
"items": { "$ref": "#/$defs/experience" },
"items": { "$ref": "#/$defs/education" },
"type": "array"
},
"interests": {
@ -92,14 +92,18 @@
"additionalProperties": false,
"type": "object"
},
"experience": {
"employment": {
"properties": {
"company": {
"description": "The company where your work experience took place.",
"type": "string"
},
"school": {
"description": "The school or university where you have studied.",
"duration": {
"description": "The duration of the experience.",
"$ref": "#/$defs/duration"
},
"jobTitle": {
"description": "The job title of your experience.",
"type": "string"
},
"location": {
@ -110,18 +114,6 @@
"description": "The location type of your work experience (e.g. Remote, Hybrid, On-site).",
"type": "string"
},
"jobTitle": {
"description": "The job title of your experience.",
"type": "string"
},
"qualification": {
"description": "The qualifications gained from this educational experience.",
"type": "string"
},
"duration": {
"description": "The duration of the experience.",
"$ref": "#/$defs/duration"
},
"details": {
"description": "Further details of the experience (e.g. achievements, daily responsibilities, etc).",
"items": {
@ -131,6 +123,43 @@
}
},
"required": [
"company",
"duration",
"jobTitle",
"location"
],
"additionalProperties": false,
"type": "object"
},
"education": {
"properties": {
"qualification": {
"description": "The qualifications gained from this educational experience.",
"type": "string"
},
"school": {
"description": "The school or university where you have studied.",
"type": "string"
},
"location": {
"description": "The location where the experience was based.",
"type": "string"
},
"duration": {
"description": "The duration of the experience.",
"$ref": "#/$defs/duration"
},
"details": {
"description": "Further details of the experience.",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"qualification",
"school",
"location",
"duration"
],