Add reject button + email on trust center access request
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -111,6 +111,53 @@ LIMIT 1;
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Files) LoadByIDs(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
fileIDs []gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
id,
|
||||
organization_id,
|
||||
bucket_name,
|
||||
mime_type,
|
||||
file_name,
|
||||
file_key,
|
||||
file_size,
|
||||
created_at,
|
||||
updated_at,
|
||||
deleted_at
|
||||
FROM
|
||||
files
|
||||
WHERE
|
||||
%s
|
||||
AND id (SELECT id FROM UNNEST(@file_ids::text[]) AS t(id))
|
||||
LIMIT 1;
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{"file_ids": fileIDs}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
rows, err := conn.Query(ctx, q, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot query file: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
files, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[File])
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot collect file: %w", err)
|
||||
}
|
||||
|
||||
*f = files
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f File) Insert(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
|
||||
Reference in New Issue
Block a user