Trust center access management - get rid of access token
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -308,6 +308,10 @@ LIMIT 1
|
||||
|
||||
customDomain, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[CustomDomain])
|
||||
if err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return ErrResourceNotFound
|
||||
}
|
||||
|
||||
return fmt.Errorf("cannot collect custom domain: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,10 @@ LIMIT 1;
|
||||
|
||||
trustCenter, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[TrustCenter])
|
||||
if err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return ErrResourceNotFound
|
||||
}
|
||||
|
||||
return fmt.Errorf("cannot collect trust center: %w", err)
|
||||
}
|
||||
|
||||
@@ -146,6 +150,10 @@ LIMIT 1;
|
||||
|
||||
trustCenter, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[TrustCenter])
|
||||
if err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return ErrResourceNotFound
|
||||
}
|
||||
|
||||
return fmt.Errorf("cannot collect trust center: %w", err)
|
||||
}
|
||||
|
||||
@@ -186,6 +194,10 @@ LIMIT 1;
|
||||
|
||||
trustCenter, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[TrustCenter])
|
||||
if err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return ErrResourceNotFound
|
||||
}
|
||||
|
||||
return fmt.Errorf("cannot collect trust center: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -290,6 +290,7 @@ func (t *TrustCenterFiles) LoadByOrganizationID(
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[TrustCenterFileOrderField],
|
||||
filter *TrustCenterFileFilter,
|
||||
) error {
|
||||
q := `
|
||||
SELECT
|
||||
@@ -307,12 +308,14 @@ WHERE
|
||||
%s
|
||||
AND organization_id = @organization_id
|
||||
AND %s
|
||||
AND %s
|
||||
`
|
||||
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment(), cursor.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
maps.Copy(args, filter.SQLArguments())
|
||||
maps.Copy(args, cursor.SQLArguments())
|
||||
|
||||
rows, err := conn.Query(ctx, q, args)
|
||||
|
||||
@@ -24,9 +24,9 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
type TrustCenterFileOption func(f *TrustCenterFileFilter)
|
||||
type TrustCenterFileFilterOption func(f *TrustCenterFileFilter)
|
||||
|
||||
func NewTrustCenterFileFilter(opts ...TrustCenterFileOption) *TrustCenterFileFilter {
|
||||
func NewTrustCenterFileFilter(opts ...TrustCenterFileFilterOption) *TrustCenterFileFilter {
|
||||
f := &TrustCenterFileFilter{}
|
||||
|
||||
for _, opt := range opts {
|
||||
@@ -36,7 +36,7 @@ func NewTrustCenterFileFilter(opts ...TrustCenterFileOption) *TrustCenterFileFil
|
||||
return f
|
||||
}
|
||||
|
||||
func WithTrustCenterFileVisibilities(visibilities ...TrustCenterVisibility) TrustCenterFileOption {
|
||||
func WithTrustCenterFileVisibilities(visibilities ...TrustCenterVisibility) TrustCenterFileFilterOption {
|
||||
return func(f *TrustCenterFileFilter) {
|
||||
f.trustCenterVisibilities = visibilities
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user