Rewrite identity and access management
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -63,24 +63,8 @@ type (
|
||||
VendorSnapshotter interface {
|
||||
InsertVendorSnapshots(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error
|
||||
}
|
||||
|
||||
ErrVendorNotFound struct {
|
||||
Identifier string
|
||||
}
|
||||
|
||||
ErrVendorAlreadyExists struct {
|
||||
message string
|
||||
}
|
||||
)
|
||||
|
||||
func (e ErrVendorNotFound) Error() string {
|
||||
return fmt.Sprintf("vendor not found: %q", e.Identifier)
|
||||
}
|
||||
|
||||
func (e ErrVendorAlreadyExists) Error() string {
|
||||
return e.message
|
||||
}
|
||||
|
||||
func (v Vendor) CursorKey(orderBy VendorOrderField) page.CursorKey {
|
||||
switch orderBy {
|
||||
case VendorOrderFieldCreatedAt:
|
||||
@@ -151,7 +135,7 @@ LIMIT 1;
|
||||
vendor, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[Vendor])
|
||||
if err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return &ErrVendorNotFound{Identifier: vendorID.String()}
|
||||
return ErrResourceNotFound
|
||||
}
|
||||
|
||||
return fmt.Errorf("cannot collect vendor: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user