wip: zen style model

This commit is contained in:
Frank
2025-10-10 00:02:04 -04:00
parent bc0e00cbb7
commit 03d5089436
7 changed files with 133 additions and 49 deletions

View File

@@ -20,8 +20,9 @@ export namespace Provider {
provider: z.string().min(1).max(64),
credentials: z.string(),
}),
({ provider, credentials }) =>
Database.use((tx) =>
async ({ provider, credentials }) => {
Actor.assertAdmin()
return Database.use((tx) =>
tx
.insert(ProviderTable)
.values({
@@ -36,14 +37,21 @@ export namespace Provider {
timeDeleted: null,
},
}),
),
)
},
)
export const remove = fn(z.object({ provider: z.string() }), ({ provider }) =>
Database.transaction((tx) =>
tx
.delete(ProviderTable)
.where(and(eq(ProviderTable.provider, provider), eq(ProviderTable.workspaceID, Actor.workspace()))),
),
export const remove = fn(
z.object({
provider: z.string(),
}),
async ({ provider }) => {
Actor.assertAdmin()
return Database.transaction((tx) =>
tx
.delete(ProviderTable)
.where(and(eq(ProviderTable.provider, provider), eq(ProviderTable.workspaceID, Actor.workspace()))),
)
},
)
}