Skip to content

Commit

Permalink
Fix nominations not being able to be created.
Browse files Browse the repository at this point in the history
Caused by supporters array being empty [] when required to be required.

Signed-off-by: miam-miam100 <[email protected]>
  • Loading branch information
miam-miam committed Mar 7, 2024
1 parent 4591f23 commit 330c0f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/payload/collections/Nominations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,12 @@ const Nominations: CollectionConfig = {
label: 'Supporters',
type: 'relationship',
relationTo: 'users',
required: true,
hasMany: true,
access: {
update: beforeVoting,
},
validate: addOwnId,
defaultValue: () => [],
defaultValue: ({ user }) => [user.id],
},
{
name: 'joinUUID',
Expand Down
3 changes: 2 additions & 1 deletion src/payload/generated-schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10024,7 +10024,7 @@ type Nomination {
election: Election!
image(where: Nomination_Image_where): Media
droppedOut: Boolean!
supporters: [User!]!
supporters: [User!]
joinUUID: String
updatedAt: DateTime
createdAt: DateTime
Expand Down Expand Up @@ -10325,6 +10325,7 @@ input Nomination_supporters_operator {
in: [JSON]
not_in: [JSON]
all: [JSON]
exists: Boolean
}

input Nomination_joinUUID_operator {
Expand Down
2 changes: 1 addition & 1 deletion src/payload/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ export interface Nomination {
election: string | Election;
image?: string | Media | null;
droppedOut: boolean;
supporters: (string | User)[];
supporters?: (string | User)[] | null;
joinUUID: string;
updatedAt: string;
createdAt: string;
Expand Down

0 comments on commit 330c0f9

Please sign in to comment.