Skip to content

Commit 3052ae8

Browse files
authored
Author news 1054 (#1196)
* Change import path * Able to change position on article
1 parent d77c8b5 commit 3052ae8

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

src/lib/news/server/actions.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,11 @@ export const createArticle: Action = async (event) => {
9999
create: !existingAuthor
100100
? {
101101
member: {
102-
connect: { studentId: user?.studentId },
102+
connect: { id: author.memberId },
103103
},
104104
mandate: author.mandateId
105105
? {
106-
connect: {
107-
member: { studentId: user?.studentId },
108-
id: author.mandateId,
109-
},
106+
connect: { id: author.mandateId },
110107
}
111108
: undefined,
112109
customAuthor: author.customId
@@ -370,17 +367,14 @@ export const updateArticle: Action<{ slug: string }> = async (event) => {
370367
id: existingAuthor.id,
371368
}
372369
: undefined,
373-
create: existingAuthor
370+
create: !existingAuthor
374371
? {
375372
member: {
376-
connect: { studentId: user?.studentId },
373+
connect: { id: author.memberId },
377374
},
378375
mandate: author.mandateId
379376
? {
380-
connect: {
381-
member: { studentId: user?.studentId },
382-
id: author.mandateId,
383-
},
377+
connect: { id: author.mandateId },
384378
}
385379
: undefined,
386380
customAuthor: author.customId

0 commit comments

Comments
 (0)