-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add archived state on project page (#4244)
- Loading branch information
Showing
13 changed files
with
70 additions
and
115 deletions.
There are no files selected for viewing
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 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 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 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
33 changes: 33 additions & 0 deletions
33
src/pages/api/juicebox/pv/[pv]/project/[projectId]/refreshMetadata.ts
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,33 @@ | ||
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs' | ||
import { NextApiRequest, NextApiResponse } from 'next' | ||
import { Database } from 'types/database.types' | ||
import { getProjectMetadata } from 'utils/server/metadata' | ||
|
||
/** | ||
* Force refresh a given project's metadata in the database. | ||
*/ | ||
const handler = async (req: NextApiRequest, res: NextApiResponse) => { | ||
if (req.method !== 'PUT') { | ||
return res.status(405).end() | ||
} | ||
|
||
try { | ||
const { projectId, pv } = req.query | ||
if (!projectId || !pv) { | ||
return res.status(400).json({ error: 'projectId is required' }) | ||
} | ||
|
||
const supabase = createServerSupabaseClient<Database>({ req, res }) | ||
|
||
const metadata = await getProjectMetadata(projectId as string) | ||
await supabase | ||
.from('projects') | ||
.update({ archived: metadata?.archived }) // TODO add more | ||
.eq('id', projectId) | ||
|
||
return res.status(204).end() | ||
} catch (error) { | ||
return res.status(500).end() | ||
} | ||
} | ||
export default handler |
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.