-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { defineType } from "sanity"; | ||
|
||
import { jobPostingID } from "studio/schemas/objects/jobPosting"; | ||
|
||
export const jobPostingsID = "jobPostings"; | ||
|
||
const jobPostings = defineType({ | ||
name: jobPostingsID, | ||
type: "document", | ||
title: "Job Postings", | ||
fields: [ | ||
{ | ||
name: "jobPostings", | ||
title: "Job Postings", | ||
type: "array", | ||
of: [{ type: jobPostingID }], | ||
}, | ||
], | ||
}); | ||
|
||
export default jobPostings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { defineType } from "sanity"; | ||
import { isInternationalizedString } from "studio/lib/interfaces/global"; | ||
import { firstTranslation } from "studio/utils/i18n"; | ||
|
||
|
||
export const jobPostingID = "jobPosting"; | ||
|
||
const jobPosting = defineType({ | ||
name: jobPostingID, | ||
title: "Job Posting", | ||
type: "object", | ||
fields: [ | ||
{ | ||
title: "Role", | ||
name: "role", | ||
type: "internationalizedArrayString", | ||
description: "The name of the role", | ||
}, | ||
{ | ||
title: "Location", | ||
name: "location", | ||
type: "reference", | ||
to: [{ type: 'companyLocation' }], | ||
description: "Where is the role located?" | ||
}, | ||
{ | ||
title: "Recruitee ad URL", | ||
name: "recruiteeAdUrl", | ||
type: "url", | ||
description: "URL to Recruitee ad", | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
title: "role", | ||
location: "location.companyLocationName", | ||
}, | ||
prepare(selection) { | ||
const { title, location } = selection; | ||
if (!isInternationalizedString(title)) { | ||
throw new TypeError( | ||
`Expected 'title' to be InternationalizedString, was ${typeof title}`, | ||
); | ||
} | ||
return { | ||
title: firstTranslation(title) ?? undefined, | ||
subtitle: location, | ||
}; | ||
}, | ||
}, | ||
}); | ||
|
||
export default jobPosting; |