File tree Expand file tree Collapse file tree
packages/utils/src/constants Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,6 @@ UNSPLASH_ACCESS_KEY=
9595STORAGE_ACCESS_KEY_ID =
9696STORAGE_SECRET_ACCESS_KEY =
9797STORAGE_ENDPOINT =
98- STORAGE_BASE_URL =
9998
10099# Used for internal monitoring & paging
101100# You can remove this by removing `DUB_SLACK_HOOK_CRON` and `DUB_SLACK_HOOK_LINKS` from the codebase
Original file line number Diff line number Diff line change @@ -44,8 +44,15 @@ export const createProgram = async ({
4444
4545 await getDomainOrThrow ( { workspace, domain } ) ;
4646
47- const programFolder = await prisma . folder . create ( {
48- data : {
47+ const programFolder = await prisma . folder . upsert ( {
48+ where : {
49+ name_projectId : {
50+ name : "Partner Links" ,
51+ projectId : workspace . id ,
52+ } ,
53+ } ,
54+ update : { } ,
55+ create : {
4956 id : createId ( { prefix : "fold_" } ) ,
5057 name : "Partner Links" ,
5158 projectId : workspace . id ,
Original file line number Diff line number Diff line change 1+ import { prisma } from "@dub/prisma" ;
2+ import { R2_URL } from "@dub/utils" ;
3+ import "dotenv-flow/config" ;
4+ import { storage } from "../../lib/storage" ;
5+
6+ async function main ( ) {
7+ const program = await prisma . program . update ( {
8+ where : {
9+ id : "prog_1JSF1XA6SP6KFW5F15FY3HCMG" ,
10+ } ,
11+ data : {
12+ defaultRewardId : null ,
13+ } ,
14+ } ) ;
15+
16+ if ( program . defaultFolderId ) {
17+ const deletedFolder = await prisma . folder . delete ( {
18+ where : {
19+ id : program . defaultFolderId ,
20+ } ,
21+ } ) ;
22+
23+ console . log ( "Deleted folder" , deletedFolder ) ;
24+ }
25+
26+ const deletedRewards = await prisma . reward . deleteMany ( {
27+ where : {
28+ programId : program . id ,
29+ } ,
30+ } ) ;
31+
32+ console . log ( "Deleted rewards" , deletedRewards ) ;
33+
34+ if ( program . logo ) {
35+ const deletedLogo = await storage . delete (
36+ program . logo . replace ( `${ R2_URL } /` , "" ) ,
37+ ) ;
38+
39+ console . log ( "Deleted logo" , deletedLogo ) ;
40+ }
41+
42+ const deletedProgram = await prisma . program . delete ( {
43+ where : {
44+ id : program . id ,
45+ } ,
46+ } ) ;
47+
48+ console . log ( "Deleted program" , deletedProgram ) ;
49+ }
50+
51+ main ( ) ;
Original file line number Diff line number Diff line change @@ -74,4 +74,4 @@ export const ACME_PROGRAM_ID = "prog_CYCu7IMAapjkRpTnr8F1azjN";
7474export const LEGAL_WORKSPACE_ID = "clrflia0j0000vs7sqfhz9c7q" ;
7575export const LEGAL_USER_ID = "clqei1lgc0000vsnzi01pbf47" ;
7676
77- export const R2_URL = process . env . STORAGE_BASE_URL as string ;
77+ export const R2_URL = "https://dubassets.com" ;
You can’t perform that action at this time.
0 commit comments