Add reject button + email on trust center access request

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-05 20:40:42 +04:00
parent 306675cd07
commit c8471cd48d
14 changed files with 3963 additions and 58 deletions

View File

@@ -132,23 +132,23 @@ func (p *Document) LoadByIDWithFilter(
filter *DocumentFilter,
) error {
q := `
SELECT
id,
organization_id,
owner_id,
title,
document_type,
classification,
current_published_version,
trust_center_visibility,
created_at,
updated_at
FROM
documents
WHERE
%s
AND deleted_at IS NULL
AND id = @document_id
SELECT
id,
organization_id,
owner_id,
title,
document_type,
classification,
current_published_version,
trust_center_visibility,
created_at,
updated_at
FROM
documents
WHERE
%s
AND deleted_at IS NULL
AND id = @document_id
AND %s
LIMIT 1;
`
@@ -178,6 +178,52 @@ LIMIT 1;
return nil
}
func (p *Documents) LoadByIDs(
ctx context.Context,
conn pg.Conn,
scope Scoper,
documentIDs []gid.GID,
) error {
q := `
SELECT
id,
organization_id,
owner_id,
title,
document_type,
classification,
current_published_version,
trust_center_visibility,
created_at,
updated_at
FROM
documents
WHERE
%s
AND deleted_at IS NULL
AND id IN (SELECT id FROM UNNEST(@document_ids::text[]) AS t(id));;
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{"document_ids": documentIDs}
maps.Copy(args, scope.SQLArguments())
rows, err := conn.Query(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot query documents: %w", err)
}
documents, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[Document])
if err != nil {
return fmt.Errorf("cannot collect documents: %w", err)
}
*p = documents
return nil
}
func (p *Documents) CountByOrganizationID(
ctx context.Context,
conn pg.Conn,