Rewrite identity and access management
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -57,24 +57,8 @@ type (
|
||||
RiskSnapshotter interface {
|
||||
InsertRiskSnapshots(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
|
||||
ErrRiskNotFound struct {
|
||||
Identifier string
|
||||
}
|
||||
|
||||
ErrRiskAlreadyExists struct {
|
||||
message string
|
||||
}
|
||||
)
|
||||
|
||||
func (e ErrRiskNotFound) Error() string {
|
||||
return fmt.Sprintf("risk not found: %q", e.Identifier)
|
||||
}
|
||||
|
||||
func (e ErrRiskAlreadyExists) Error() string {
|
||||
return e.message
|
||||
}
|
||||
|
||||
func (r *Risk) CursorKey(orderBy RiskOrderField) page.CursorKey {
|
||||
switch orderBy {
|
||||
case RiskOrderFieldCreatedAt:
|
||||
@@ -392,7 +376,7 @@ LIMIT 1;
|
||||
risk, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[Risk])
|
||||
if err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return &ErrRiskNotFound{Identifier: riskID.String()}
|
||||
return ErrResourceNotFound
|
||||
}
|
||||
|
||||
return fmt.Errorf("cannot collect risk: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user