-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schedule unfeaturing listing in 7 days with Trigger
- Loading branch information
1 parent
aa7a9eb
commit 92c3534
Showing
5 changed files
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
import { logger, task, wait } from '@trigger.dev/sdk/v3' | ||
import { REMOTE_URL } from '@helpers/config' | ||
|
||
export const unfeatureListingTask = task({ | ||
id: 'unfeature-listing', | ||
run: async (payload: any, { ctx }) => { | ||
logger.log('Scheduling job to unfeature listing in 7 days', { | ||
payload, | ||
ctx, | ||
}) | ||
const { listingId } = payload | ||
|
||
await wait.for({ minutes: 1 }) | ||
await fetch(`${REMOTE_URL}/api/listing/${listingId}/unfeature`, { | ||
method: 'PATCH', | ||
}) | ||
|
||
return { | ||
message: 'Hello, world!', | ||
} | ||
}, | ||
}) |