Skip to content

Commit c9a1283

Browse files
committed
chore: cleanup: remove cancelScheduledPost mutation
1 parent 7207cbf commit c9a1283

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

api/resolvers/item.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,42 +1095,6 @@ export default {
10951095

10961096
return result
10971097
},
1098-
cancelScheduledPost: async (parent, { id }, { me, models }) => {
1099-
if (!me) {
1100-
throw new GqlAuthenticationError()
1101-
}
1102-
1103-
const item = await models.item.findUnique({
1104-
where: { id: Number(id) }
1105-
})
1106-
1107-
if (!item) {
1108-
throw new GqlInputError('item not found')
1109-
}
1110-
1111-
if (Number(item.userId) !== Number(me.id)) {
1112-
throw new GqlInputError('item does not belong to you')
1113-
}
1114-
1115-
if (!item.scheduledAt) {
1116-
throw new GqlInputError('item is not scheduled')
1117-
}
1118-
1119-
// Cancel the scheduled job
1120-
await models.$queryRaw`
1121-
DELETE FROM pgboss.job
1122-
WHERE name = 'publishScheduledPost'
1123-
AND data->>'itemId' = ${item.id}::TEXT
1124-
AND state <> 'completed'`
1125-
1126-
// Update the item to remove scheduling
1127-
return await models.item.update({
1128-
where: { id: Number(id) },
1129-
data: {
1130-
scheduledAt: null
1131-
}
1132-
})
1133-
},
11341098
publishScheduledPostNow: async (parent, { id }, { me, models }) => {
11351099
if (!me) {
11361100
throw new GqlAuthenticationError()

api/typeDefs/item.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export default gql`
6464
act(id: ID!, sats: Int, act: String, hasSendWallet: Boolean): ItemActPaidAction!
6565
pollVote(id: ID!): PollVotePaidAction!
6666
toggleOutlaw(id: ID!): Item!
67-
cancelScheduledPost(id: ID!): Item!
6867
publishScheduledPostNow(id: ID!): Item!
6968
}
7069

0 commit comments

Comments
 (0)