-
Notifications
You must be signed in to change notification settings - Fork 2.8k
FEAT: Bounties #2736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
FEAT: Bounties #2736
Changes from all commits
Commits
Show all changes
290 commits
Select commit
Hold shift + click to select a range
29e6c1a
Merge branch 'main' into bounties
steven-tey f348ce7
WIP group mult-select
TWilson023 6a897d4
Merge branch 'main' into bounties
steven-tey 721b403
Update groups-multi-select.tsx
TWilson023 7cfc109
Merge branch 'bounties' of github.com:dubinc/dub into bounties
TWilson023 67d9c5c
Add conditional logic section
TWilson023 0b42d8b
Merge branch 'main' into bounties
devkiran eb3fc04
Merge branch 'main' into bounties
devkiran 8a7535a
Bounty endpoint updates
TWilson023 aa4fb50
partners -> partnersCount
TWilson023 3630f73
WIP+fixes
TWilson023 11e6bd0
WIP bounty logic
TWilson023 2d7ff5d
Add (temporary?) performance logic stuff
TWilson023 0d331b6
Add bounty card menu
TWilson023 934cf3a
WIP edit bounties
TWilson023 c43e773
Edit bounties
TWilson023 9a90d58
Merge branch 'bounties' of https://github.com/dubinc/dub into bounties
devkiran cee46c1
workflow wip
devkiran 421b62d
Update workflows.ts
devkiran c6c4ec9
Update workflows.ts
devkiran dc9720b
Update workflows.ts
devkiran 52902f1
Merge branch 'main' into bounties
steven-tey ddd434e
Delete bounties
TWilson023 5d89265
Merge branch 'bounties' of github.com:dubinc/dub into bounties
TWilson023 15f552f
Update bounty groups
TWilson023 079c5ab
Update workflows.ts
devkiran ea70224
Update workflow.prisma
devkiran e36a5f1
Merge branch 'bounties' of https://github.com/dubinc/dub into bounties
devkiran 5f9abaa
workflow schema
devkiran f9236e7
Update workflows.ts
devkiran 0b35358
add workflow type
devkiran 2105b55
Update add-edit-bounty-sheet.tsx
devkiran 44436b0
Update bounty-list.tsx
devkiran 3da1d3b
create workflow for performance based bounty
devkiran 29c32cd
wip validatePerformanceBounty
devkiran 51cadc0
Implement performance bounty validation and commission creation logic…
devkiran e78f8dc
Refactor bounty workflow handling: remove validatePerformanceBounty f…
devkiran a16eed1
Update create-partner-commission.ts
devkiran 7f28083
Update workflow.prisma
devkiran 8f74424
Update execute-bounty-workflow.ts
devkiran 5803a71
reject a bounty submission
devkiran 6166191
Approve a bounty submission
devkiran d0ad3d2
Update route.ts
devkiran a074e3a
update /api/bounties/stats
devkiran d1f6e57
Update bounty-card.tsx
devkiran a4d2458
Update bounty.ts
devkiran 4b338c8
Hide submission requirements for performance based bounty
devkiran 5bec3af
Refactor BountyInfo to use useBountyStats for submission
devkiran 0089fb1
Fix the submissions table
devkiran a086659
Fix bounties empty state create button
TWilson023 3fd735a
Merge branch 'bounties' of github.com:dubinc/dub into bounties
TWilson023 17aca94
Update groups-multi-select.tsx
TWilson023 e80fa25
WIP `partners.` bounties
TWilson023 07258f0
Update bounty-card.tsx
TWilson023 67a277d
Bounty card tweaks
TWilson023 7ed2bf8
approve and reject bounty submissions
devkiran 15ea7ee
Merge branch 'bounties' of https://github.com/dubinc/dub into bounties
devkiran 247c8d1
Add back button from bounty details page to the list page
devkiran 6232deb
Update bounty.prisma
devkiran bc8a3f2
add BountyHeaderTitle
devkiran 80e4bdf
Update bounties.ts
devkiran 36481d0
Update bounty.prisma
devkiran 4257e7d
wip email templates
devkiran a533831
Merge branch 'main' into bounties
devkiran aca330a
Add submission statuses
TWilson023 3332eda
Merge branch 'bounties' of github.com:dubinc/dub into bounties
TWilson023 5284778
WIP claim bounty modal
TWilson023 e44a47e
File uploads
TWilson023 a09496f
Update route.ts
devkiran ccf6c19
Update bounties.ts
devkiran f2a9e7d
Merge branch 'bounties' of https://github.com/dubinc/dub into bounties
devkiran 1539fb8
update the submission upload URL
devkiran 12d56d6
improve the workflows
devkiran 47c1105
Merge branch 'main' into bounties
devkiran a5c087b
fix workflow
devkiran a958f99
update the id prefixes
devkiran cf00962
update bounty details sheet
devkiran de7a161
Refactor bounty thumbnail and add completed email template
devkiran a65f119
Update bounty-completed.tsx
devkiran dd4c2b0
Update bounty-rejected.tsx
devkiran 825ba03
Update bounty-approved.tsx
devkiran e288ebb
Update execute-award-bounty-action.ts
devkiran 6bee6bb
bounty approved email
devkiran c6f9842
bounty rejected email
devkiran 40ea966
Bounty completed email
devkiran 516a672
Update claim-bounty-modal.tsx
TWilson023 8ab230a
Update claim-bounty-modal.tsx
TWilson023 bb5f0d2
Add bounty submission
TWilson023 1ce2287
return the groups
devkiran 2744d9b
Update get-bounties.ts
devkiran 199021d
Bounty submission success
TWilson023 8270f39
Trigger workflows on lead and sale events in Stripe webhooks
devkiran c52110f
Merge branch 'bounties' of https://github.com/dubinc/dub into bounties
devkiran d883c9d
Bounty submission tweaks + statuses
TWilson023 8e4677f
Merge branch 'bounties' of github.com:dubinc/dub into bounties
TWilson023 e8d1a3e
Update add-edit-bounty-sheet.tsx
TWilson023 67291ec
Misc. fixes
TWilson023 cb4a4f1
Bounty info updates
TWilson023 d3a96eb
Bounty submission sheet updates
TWilson023 d455c14
Update route.ts
TWilson023 ce1b9b7
Add pending bounty submissions count to sidebar
TWilson023 b812023
Merge branch 'main' into bounties
steven-tey 3fe3901
Merge branch 'main' into bounties
steven-tey ca1eec2
Update bounty.prisma
devkiran f329156
Update create-bounty-submission.ts
devkiran a1c072b
rename
devkiran 1dff28a
performance based bounty updates
devkiran 72238ae
Update bounty-submission-details-sheet.tsx
devkiran bda0761
Update bounty-submission-details-sheet.tsx
devkiran cf767d6
update bounty
devkiran b2e7782
Create bounty-pending-review.tsx
devkiran 5d59fec
Update create-bounty-submission.ts
devkiran 9ee42ad
Update bounty-pending-review.tsx
devkiran ebbaae7
send BountyPendingReview email
devkiran 427d538
send BountySubmitted email
devkiran 6895c9d
adjust the schema
devkiran 4620c45
Update bounty-submission-details-sheet.tsx
devkiran 69fed8f
Add partner bounty submission query with filters
devkiran 7c66e61
format
devkiran 15b6333
add bounty webhooks
devkiran 3a12d65
fix sorting
devkiran 91ca50c
fix the sorting again
devkiran b226892
Add progress circles to submissions table
TWilson023 2a65705
Update progress-circle.tsx
TWilson023 256f066
Add performance bounty progress UI
TWilson023 0268e04
Refactor useBounty hook loading state
devkiran c99d04a
add additional validation to createBountySubmissionAction
devkiran d78ac63
add NewBountyPublished email template
devkiran 407fb58
Add cron route for sending bounty published emails
devkiran 20b6f8c
Refactor bounty retrieval and metrics aggregation
devkiran 4a564b3
Enhance bounty submission functionality by defining maximum limits fo…
devkiran 58945bc
Update bounty-completed.tsx
devkiran 2bde778
Update upload-bounty-submission-file.ts
devkiran b68354f
Add 'newBountySubmitted' notification preference
devkiran 6175ade
Update route.ts
devkiran 73a54c1
Update get-partners-with-bounty-submission.ts
devkiran 1716704
Update types.ts
devkiran a85849e
Update bounty-submissions-table.tsx
devkiran aa65e62
Update commission.prisma
devkiran a71ea11
Merge branch 'main' into bounties
devkiran e502c3d
Update get-bounties.ts
devkiran 801746c
Merge branch 'bounties' of https://github.com/dubinc/dub into bounties
devkiran 1319991
Refactor bounty stats API and usage
devkiran 2f7bf76
Refactor bounty submissions and partners data structure
devkiran a3c96d9
Update route.ts
devkiran a806df5
Update bounty-info.tsx
devkiran f53e020
Update get-bounties.ts
devkiran 74db347
Update get-bounty-or-throw.ts
devkiran 04ebc1e
Update bounty-info.tsx
devkiran 787c805
Update bounty-card.tsx
devkiran 14c6e6b
Refactor bounty action menu into reusable component
devkiran df59185
Refactor bounty sheet integration and button logic
devkiran cc6740c
Add advanced filters to bounty submissions API
devkiran a034ba3
Merge branch 'main' into bounties
devkiran ea98ff0
Update execute-award-bounty-action.ts
devkiran 4d360e7
Preserve line breaks in bounty description
devkiran 4897f31
use the prefix for bounty submission
devkiran 6de13ca
Enforce max limits on bounty submission files and URLs
devkiran 803d518
Preserve line breaks in bounty submission description
devkiran 00bdafa
Update execute-award-bounty-action.ts
devkiran aa23934
Add all completed state to program bounty card
TWilson023 7d53f87
Workflow context `totalCommissions` -> `totalCommission`
TWilson023 6e82fda
Bounty completed state updates
TWilson023 15314c3
Merge branch 'bounties' of https://github.com/dubinc/dub into bounties
devkiran 673583b
format
devkiran 2015e68
Refactor bounty attribute labels and name generation
devkiran 0a089ea
Update transform.ts
devkiran fac0fdb
Update use-bounty-submissions-count.ts
devkiran d980ac5
Update bounty-created.json
devkiran 80fd706
Update bounty-updated.json
devkiran 56524aa
Delete bounty.ts
devkiran 3e2033d
Update reject-bounty-submission-modal.tsx
devkiran e6e4a34
Update bounty-submitted.tsx
devkiran 2ddcdda
Bounty validation/form improvements
TWilson023 fb4bfb5
Add submission filters
TWilson023 9ff0c66
Update bounty-thumbnail.tsx
TWilson023 22c8325
Update bounty-card.tsx
TWilson023 7f41900
Update bounty-card.tsx
TWilson023 f8a3298
Fix circular dependency
TWilson023 49341d6
Badges + filters cleanup
TWilson023 ecf014b
Add disabledAt field to Workflow model
devkiran d105fc4
Update route.ts
devkiran 0ed626e
Merge branch 'main' into bounties
devkiran 83bee30
Merge branch 'main' into bounties
devkiran 4d0797e
Update commission.prisma
devkiran 6e92b3e
Update use-bounty-submission-filters.tsx
TWilson023 64d399e
Update bounty-list.tsx
TWilson023 b39b32f
Update animated-empty-state.tsx
TWilson023 402c042
Groups selector fixes
TWilson023 3f3ab45
Fix performanceCondition in bounty form
TWilson023 10d8ee1
Performance bounty submission filters
TWilson023 8e048aa
Update bounty-submission-details-sheet.tsx
TWilson023 2c73c2b
Update execute-award-bounty-action.ts
TWilson023 cb0bf06
Merge branch 'main' into bounties
TWilson023 14a16d3
Merge branch 'main' into bounties
steven-tey 8b332d8
Merge branch 'main' into bounties
steven-tey 41f0bc7
Merge branch 'main' into bounties
steven-tey 963b316
move Resources under Engagement
steven-tey e9115ca
update NewBountyAvailable email
steven-tey cc96375
add trailingZeroDisplay: "stripIfInteger"
steven-tey 1312c56
updates to email language
steven-tey 45a2b63
reuse aggregatePartnerLinksStats
steven-tey 4c2171f
fix type error
steven-tey df69d17
fix date schema
steven-tey 51b8d74
add programBountiesCount
steven-tey d55d940
disable deletion for bounties with submissions
steven-tey 00ae028
Update menu-item.tsx
steven-tey 7f89f97
remove date rang picker for bounty submissions table
steven-tey a42f96c
Update create-partner-commission.ts
devkiran ff8e5be
Merge branch 'main' into bounties
steven-tey d006698
Merge branch 'main' into bounties
steven-tey 62dffb5
Merge branch 'main' into bounties
steven-tey 5e8c3a6
improve `/bounties` endpoint latency
steven-tey dae7352
fix BountyProps vs BountyExtendedProps
steven-tey c270b8c
split out partner side types, totalCommission → totalCommissions
steven-tey 8b9f30c
missed a spot
steven-tey 998db26
BountySchema + BountyListSchema, getBountyWithDetails
steven-tey 318b504
fix types
steven-tey b60afbe
onWheel={(e) => e.currentTarget.blur()}
steven-tey aa66a4c
final changes
steven-tey feaaeb0
only show group filter options that are part of the bounty
steven-tey ae07c6e
fix get available bounties for an enrolled program
devkiran 47fc53e
Update bounty-action-button.tsx
devkiran b846182
Delete use-api-mutation.ts
devkiran c4c18d9
Update add-edit-bounty-sheet.tsx
devkiran 9726b48
Update add-edit-bounty-sheet.tsx
devkiran 606913c
add skipWorkflow
devkiran a690c59
Update route.ts
devkiran 2e6f613
Update bounties.ts
devkiran 591a849
Update integration.ts
devkiran 1f11afd
Create index.test.ts
devkiran ce5fe0e
update BOUNTY_GROUP_ID, remove test.skip
steven-tey 8ab47d0
Merge pull request #2786 from dubinc/bounties-updates
steven-tey 1735ce6
Merge branch 'main' into bounties
steven-tey 130d30d
return early if invalid groupIds
steven-tey 5df2481
Check if bounty start date is at least 10 minutes in the past
devkiran a2d486d
small fix
devkiran 081a0fc
simplify with notBefore, reenable email sending
steven-tey 51f10f5
finalize bounties/notify-partners cron
steven-tey 81fca53
Update bounty-action-button.tsx
steven-tey 2cf55c0
add bounties to audit logs, finalize bounty response schema
steven-tey ce575ef
process a single page per invocation and re-enqueue next page via QStash
steven-tey b94d76d
generateBountyName + make bounty.name non null
steven-tey f69991e
Update add-edit-bounty-sheet.tsx
steven-tey 53fe04c
fix bounty.name field type
steven-tey 9394882
add bounty_submission.approved and rejected to audit logs, add View c…
steven-tey ba9c55b
final changes
steven-tey 00c87ea
add bounty.deleted audit log, finalize tests
steven-tey e979bf7
final fixes (executeWorkflows, bounty_submission audit logs)
steven-tey bd43161
fix tests
steven-tey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,280 @@ | ||
| import { recordAuditLog } from "@/lib/api/audit-logs/record-audit-log"; | ||
| import { getBountyWithDetails } from "@/lib/api/bounties/get-bounty-with-details"; | ||
| import { DubApiError } from "@/lib/api/errors"; | ||
| import { throwIfInvalidGroupIds } from "@/lib/api/groups/throw-if-invalid-group-ids"; | ||
| import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw"; | ||
| import { parseRequestBody } from "@/lib/api/utils"; | ||
| import { withWorkspace } from "@/lib/auth"; | ||
| import { qstash } from "@/lib/cron"; | ||
| import { sendWorkspaceWebhook } from "@/lib/webhook/publish"; | ||
| import { | ||
| BountySchema, | ||
| BountySchemaExtended, | ||
| updateBountySchema, | ||
| } from "@/lib/zod/schemas/bounties"; | ||
| import { prisma } from "@dub/prisma"; | ||
| import { APP_DOMAIN_WITH_NGROK, arrayEqual } from "@dub/utils"; | ||
| import { PartnerGroup, Prisma } from "@prisma/client"; | ||
| import { waitUntil } from "@vercel/functions"; | ||
| import { NextResponse } from "next/server"; | ||
|
|
||
| // GET /api/bounties/[bountyId] - get a bounty | ||
| export const GET = withWorkspace( | ||
| async ({ workspace, params }) => { | ||
| const { bountyId } = params; | ||
|
|
||
| const programId = getDefaultProgramIdOrThrow(workspace); | ||
|
|
||
| const bounty = await getBountyWithDetails({ | ||
| bountyId, | ||
| programId, | ||
| }); | ||
|
|
||
| return NextResponse.json(BountySchemaExtended.parse(bounty)); | ||
| }, | ||
| { | ||
| requiredPlan: [ | ||
| "business", | ||
| "business plus", | ||
| "business extra", | ||
| "business max", | ||
| "advanced", | ||
| "enterprise", | ||
| ], | ||
| }, | ||
| ); | ||
|
|
||
| // PATCH /api/bounties/[bountyId] - update a bounty | ||
| export const PATCH = withWorkspace( | ||
| async ({ workspace, params, req, session }) => { | ||
| const { bountyId } = params; | ||
| const programId = getDefaultProgramIdOrThrow(workspace); | ||
|
|
||
| const { | ||
| name, | ||
| description, | ||
| startsAt, | ||
| endsAt, | ||
| rewardAmount, | ||
| submissionRequirements, | ||
| performanceCondition, | ||
| groupIds, | ||
| } = updateBountySchema.parse(await parseRequestBody(req)); | ||
|
|
||
| if (startsAt && endsAt && endsAt < startsAt) { | ||
| throw new DubApiError({ | ||
| message: "endsAt must be on or after startsAt.", | ||
| code: "bad_request", | ||
| }); | ||
| } | ||
| const bounty = await prisma.bounty.findUniqueOrThrow({ | ||
| where: { | ||
| id: bountyId, | ||
| programId, | ||
| }, | ||
| include: { | ||
| groups: true, | ||
| }, | ||
| }); | ||
|
|
||
| // TODO: | ||
| // When we do archive, make sure it disables the workflow | ||
steven-tey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // if groupIds is provided and is different from the current groupIds, update the groups | ||
| let updatedPartnerGroups: PartnerGroup[] | undefined = undefined; | ||
| if ( | ||
| groupIds && | ||
| !arrayEqual( | ||
| bounty.groups.map((group) => group.groupId), | ||
| groupIds, | ||
| ) | ||
| ) { | ||
| updatedPartnerGroups = await throwIfInvalidGroupIds({ | ||
| programId, | ||
| groupIds, | ||
| }); | ||
| } | ||
|
|
||
| const data = await prisma.$transaction(async (tx) => { | ||
| const updatedBounty = await tx.bounty.update({ | ||
| where: { | ||
| id: bounty.id, | ||
| }, | ||
| data: { | ||
| name: name ?? undefined, | ||
| description, | ||
| startsAt: startsAt!, // Can remove the ! when we're on a newer TS version (currently 5.4.4) | ||
steven-tey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| endsAt, | ||
| rewardAmount, | ||
| ...(bounty.type === "submission" && | ||
| submissionRequirements !== undefined && { | ||
| submissionRequirements: submissionRequirements ?? Prisma.JsonNull, | ||
| }), | ||
| ...(updatedPartnerGroups && { | ||
| groups: { | ||
| deleteMany: {}, | ||
| create: updatedPartnerGroups.map((group) => ({ | ||
| groupId: group.id, | ||
| })), | ||
| }, | ||
| }), | ||
| }, | ||
| include: { | ||
| workflow: true, | ||
| groups: true, | ||
| }, | ||
| }); | ||
|
|
||
| if (updatedBounty.workflowId && performanceCondition) { | ||
| await tx.workflow.update({ | ||
| where: { | ||
| id: updatedBounty.workflowId, | ||
| }, | ||
| data: { | ||
| triggerConditions: [performanceCondition], | ||
| }, | ||
| }); | ||
| } | ||
steven-tey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { | ||
| ...updatedBounty, | ||
| performanceCondition, | ||
| }; | ||
| }); | ||
|
|
||
| const updatedBounty = BountySchema.parse({ | ||
| ...data, | ||
| groups: data.groups.map(({ groupId }) => ({ id: groupId })), | ||
| performanceCondition: data.workflow?.triggerConditions?.[0], | ||
| }); | ||
|
|
||
| waitUntil( | ||
| Promise.allSettled([ | ||
| recordAuditLog({ | ||
| workspaceId: workspace.id, | ||
| programId, | ||
| action: "bounty.updated", | ||
| description: `Bounty ${bounty.id} updated`, | ||
| actor: session?.user, | ||
| targets: [ | ||
| { | ||
| type: "bounty", | ||
| id: bounty.id, | ||
| metadata: updatedBounty, | ||
| }, | ||
| ], | ||
| }), | ||
| sendWorkspaceWebhook({ | ||
| workspace, | ||
| trigger: "bounty.updated", | ||
| data: updatedBounty, | ||
| }), | ||
|
|
||
| // if bounty.startsAt was updated, publish a new message to the queue | ||
| updatedBounty.startsAt.getTime() !== bounty.startsAt.getTime() && | ||
| qstash.publishJSON({ | ||
| url: `${APP_DOMAIN_WITH_NGROK}/api/cron/bounties/notify-partners`, | ||
| body: { | ||
| bountyId: updatedBounty.id, | ||
| }, | ||
| notBefore: Math.floor(updatedBounty.startsAt.getTime() / 1000), | ||
| }), | ||
| ]), | ||
| ); | ||
|
|
||
| return NextResponse.json(updatedBounty); | ||
| }, | ||
| { | ||
| requiredPlan: [ | ||
| "business", | ||
| "business plus", | ||
| "business extra", | ||
| "business max", | ||
| "advanced", | ||
| "enterprise", | ||
| ], | ||
| }, | ||
| ); | ||
|
|
||
| // DELETE /api/bounties/[bountyId] - delete a bounty | ||
| export const DELETE = withWorkspace( | ||
| async ({ workspace, params, session }) => { | ||
| const { bountyId } = params; | ||
| const programId = getDefaultProgramIdOrThrow(workspace); | ||
|
|
||
| const bounty = await prisma.bounty.findUniqueOrThrow({ | ||
| where: { | ||
| id: bountyId, | ||
| programId, | ||
| }, | ||
| include: { | ||
| groups: true, | ||
| workflow: true, | ||
| _count: { | ||
| select: { | ||
| submissions: true, | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| if (bounty._count.submissions > 0) { | ||
| throw new DubApiError({ | ||
| message: | ||
| "Bounties with submissions cannot be deleted. You can archive them instead.", | ||
| code: "bad_request", | ||
| }); | ||
| } | ||
|
|
||
| await prisma.$transaction(async (tx) => { | ||
| const bounty = await tx.bounty.delete({ | ||
| where: { | ||
| id: bountyId, | ||
| }, | ||
| }); | ||
|
|
||
| if (bounty.workflowId) { | ||
| await tx.workflow.delete({ | ||
| where: { | ||
| id: bounty.workflowId, | ||
| }, | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| const deletedBounty = BountySchema.parse({ | ||
| ...bounty, | ||
| groups: bounty.groups.map(({ groupId }) => ({ id: groupId })), | ||
| performanceCondition: bounty.workflow?.triggerConditions?.[0], | ||
| }); | ||
|
|
||
| waitUntil( | ||
| recordAuditLog({ | ||
| workspaceId: workspace.id, | ||
| programId, | ||
| action: "bounty.deleted", | ||
| description: `Bounty ${bountyId} deleted`, | ||
| actor: session?.user, | ||
| targets: [ | ||
| { | ||
| type: "bounty", | ||
| id: bountyId, | ||
| metadata: deletedBounty, | ||
| }, | ||
| ], | ||
| }), | ||
| ); | ||
|
|
||
| return NextResponse.json({ id: bountyId }); | ||
| }, | ||
| { | ||
| requiredPlan: [ | ||
| "business", | ||
| "business plus", | ||
| "business extra", | ||
| "business max", | ||
| "advanced", | ||
| "enterprise", | ||
| ], | ||
| }, | ||
| ); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO comment indicates incomplete archive functionality that could leave workflows active when bounties are archived.
View Details
Analysis
The TODO comment on lines 79-80 states "When we do archive, make sure it disables the workflow". This indicates that the archive functionality is incomplete and could lead to workflows continuing to execute even after their associated bounties are archived.
This could cause several issues:
This TODO indicates production-ready functionality is missing. The workflow should be disabled/deleted when a bounty is archived, similar to how it's handled in the DELETE endpoint (lines 188-194).