Add authenticated login and SSO protection
This commit is contained in:
@@ -53,6 +53,17 @@ export async function getAsset(id: string): Promise<Asset | null> {
|
||||
return state.assets.find((asset) => asset.id === id) || null;
|
||||
}
|
||||
|
||||
export async function getAssetByStoragePath(storagePath: string): Promise<Asset | null> {
|
||||
const supabase = getSupabaseAdmin();
|
||||
if (supabase) {
|
||||
const { data, error } = await supabase.from("assets").select("*").eq("storage_path", storagePath).maybeSingle();
|
||||
if (error) throw new Error(error.message);
|
||||
return data ? assetFromRow(data) : null;
|
||||
}
|
||||
const state = await readState();
|
||||
return state.assets.find((asset) => asset.storagePath === storagePath) || null;
|
||||
}
|
||||
|
||||
export async function createAsset(input: AssetInput): Promise<Asset> {
|
||||
const now = new Date().toISOString();
|
||||
const asset: Asset = {
|
||||
|
||||
Reference in New Issue
Block a user