Add organization deletion

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-08-07 17:08:04 +02:00
parent c9ab0678be
commit ab97fc8cf8
16 changed files with 958 additions and 232 deletions

View File

@@ -250,6 +250,25 @@ DELETE FROM documents WHERE %s AND id = @document_id
return err
}
func (p Document) DeleteByOrganizationID(
ctx context.Context,
conn pg.Conn,
scope Scoper,
organizationID gid.GID,
) error {
q := `
DELETE FROM documents WHERE %s AND organization_id = @organization_id
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{"organization_id": organizationID}
maps.Copy(args, scope.SQLArguments())
_, err := conn.Exec(ctx, q, args)
return err
}
func (p *Document) Update(
ctx context.Context,
conn pg.Conn,