-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add committee members and committees collections
- Loading branch information
1 parent
1392a9b
commit a51a118
Showing
8 changed files
with
3,412 additions
and
1,152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { CollectionConfig } from "payload/types"; | ||
import { signedIn } from "../../access/signed-in"; | ||
import { guildYearField } from "../../fields/guild-year"; | ||
|
||
export const CommitteeMembers: CollectionConfig = { | ||
slug: "committee-members", | ||
defaultSort: "-guildYear", | ||
admin: { | ||
useAsTitle: "name", | ||
}, | ||
access: { | ||
read: () => true, | ||
create: signedIn, | ||
update: signedIn, | ||
delete: signedIn, | ||
}, | ||
fields: [ | ||
guildYearField({ | ||
name: "guildYear", | ||
required: true, | ||
}), | ||
{ | ||
name: "photo", | ||
type: "relationship", | ||
relationTo: "media", | ||
}, | ||
{ | ||
name: "name", | ||
type: "text", | ||
required: true, | ||
}, | ||
{ | ||
name: "title", | ||
type: "text", | ||
required: true, | ||
localized: true, | ||
}, | ||
{ | ||
name: "chair", | ||
type: "checkbox", | ||
}, | ||
{ | ||
name: "telegramUsername", | ||
type: "text", | ||
}, | ||
], | ||
}; |
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,57 @@ | ||
import type { Committee } from "@tietokilta/cms-types/payload"; | ||
import type { CollectionConfig, FilterOptions } from "payload/types"; | ||
import { signedIn } from "../../access/signed-in"; | ||
import { guildYearField } from "../../fields/guild-year"; | ||
|
||
const filterCurrentYear: FilterOptions<Committee> = ({ data }) => ({ | ||
guildYear: { | ||
equals: data.year, | ||
}, | ||
}); | ||
|
||
export const Committees: CollectionConfig = { | ||
slug: "committees", | ||
defaultSort: "-year", | ||
admin: { | ||
useAsTitle: "name", | ||
defaultColumns: ["year", "name", "committeeMembers"], | ||
}, | ||
access: { | ||
read: () => true, | ||
create: signedIn, | ||
update: signedIn, | ||
delete: signedIn, | ||
}, | ||
fields: [ | ||
guildYearField({ | ||
name: "year", | ||
required: true, | ||
}), | ||
{ | ||
name: "name", | ||
type: "text", | ||
required: true, | ||
localized: true, | ||
}, | ||
{ | ||
name: "description", | ||
type: "richText", | ||
localized: true, | ||
required: true, | ||
}, | ||
{ | ||
name: "committeeMembers", | ||
type: "array", | ||
required: true, | ||
minRows: 1, | ||
fields: [ | ||
{ | ||
name: "committeeMember", | ||
type: "relationship", | ||
relationTo: "committee-members", | ||
filterOptions: filterCurrentYear, | ||
}, | ||
], | ||
}, | ||
], | ||
}; |
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,56 @@ | ||
[{ | ||
"_id": { | ||
"$oid": "65bbf2b2c081d0fba3620f3c" | ||
}, | ||
"guildYear": "2024", | ||
"name": "Joonatan Korpela", | ||
"title": { | ||
"fi": "Digivastaava" | ||
}, | ||
"chair": true, | ||
"createdAt": { | ||
"$date": "2024-02-01T19:36:18.175Z" | ||
}, | ||
"updatedAt": { | ||
"$date": "2024-02-01T19:46:53.528Z" | ||
}, | ||
"__v": 0, | ||
"telegramUsername": "@joonatan_aatos" | ||
}, | ||
{ | ||
"_id": { | ||
"$oid": "65bbf2cec081d0fba3620f40" | ||
}, | ||
"guildYear": "2024", | ||
"name": "Mikael Siidorow", | ||
"title": { | ||
"fi": "Diginatiivi" | ||
}, | ||
"chair": false, | ||
"createdAt": { | ||
"$date": "2024-02-01T19:36:46.361Z" | ||
}, | ||
"updatedAt": { | ||
"$date": "2024-02-01T19:36:46.361Z" | ||
}, | ||
"__v": 0 | ||
}, | ||
{ | ||
"_id": { | ||
"$oid": "65bbf2f1c081d0fba3620f44" | ||
}, | ||
"guildYear": "2024", | ||
"name": "Petrus Asikainen", | ||
"title": { | ||
"fi": "Lead Purkka Coder" | ||
}, | ||
"chair": false, | ||
"createdAt": { | ||
"$date": "2024-02-01T19:37:21.184Z" | ||
}, | ||
"updatedAt": { | ||
"$date": "2024-02-01T19:37:21.184Z" | ||
}, | ||
"__v": 0 | ||
}] | ||
|
Oops, something went wrong.