chore: generate
This commit is contained in:
parent
9b815bcbd2
commit
8dc2ffd48f
11 changed files with 940 additions and 450 deletions
|
|
@ -54,14 +54,23 @@ export const layer = Layer.effect(
|
|||
.where(input?.projectID ? eq(PermissionTable.project_id, input.projectID) : undefined)
|
||||
.all()
|
||||
.pipe(Effect.orDie)
|
||||
return rows.map((row): Info => ({ id: row.id, projectID: row.project_id, action: row.action, resource: row.resource }))
|
||||
return rows.map(
|
||||
(row): Info => ({ id: row.id, projectID: row.project_id, action: row.action, resource: row.resource }),
|
||||
)
|
||||
})
|
||||
|
||||
const add = Effect.fn("PermissionSaved.add")(function* (input: AddInput) {
|
||||
if (!input.resources.length) return
|
||||
yield* db
|
||||
.insert(PermissionTable)
|
||||
.values(input.resources.map((resource) => ({ id: ID.create(), project_id: input.projectID, action: input.action, resource })))
|
||||
.values(
|
||||
input.resources.map((resource) => ({
|
||||
id: ID.create(),
|
||||
project_id: input.projectID,
|
||||
action: input.action,
|
||||
resource,
|
||||
})),
|
||||
)
|
||||
.onConflictDoNothing()
|
||||
.run()
|
||||
.pipe(Effect.orDie)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue