Skip to content

Commit

Permalink
La til vekting på stillingsannonser (#2210)
Browse files Browse the repository at this point in the history
  • Loading branch information
0Zeno authored Aug 30, 2024
1 parent 388150e commit d4b79db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/cms/schemas/job-ad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export default defineType({
to: { type: "company" },
validation: (Rule) => Rule.required(),
}),
defineField({
name: "weight",
title: "Vekting",
type: "number",
initialValue: 0,
validation: (Rule) => Rule.required(),
}),
defineField({
name: "locations",
title: "Sted(er)",
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/sanity.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ export type JobAdsQueryResult = Array<{
_id: string;
_createdAt: string;
_updatedAt: string;
weight: number;
title: string;
slug: string;
company: {
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/sanity/job-ad/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import groq from "groq";
export const jobAdsQuery = groq`
*[_type == "job"
&& !(_id in path('drafts.**'))]
| order(_createdAt desc) {
| order(weight desc, deadline desc) {
_id,
_createdAt,
_updatedAt,
weight,
title,
"slug": slug.current,
"company": company->{
Expand Down

0 comments on commit d4b79db

Please sign in to comment.