Files
online-backend/internal/identity/user/storage.go
GuwandykA 323e131216
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled
changed role permission
2026-09-26 16:34:28 +05:00

27 lines
1.1 KiB
Go

package user
import (
"context"
"online-back/internal/identity/rbac"
)
type Repository interface {
List(ctx context.Context, filter ListFilter) (ListUserDTO, error)
ListStaff(ctx context.Context, filter ListFilter) (ListUserDTO, error)
GetByID(ctx context.Context, id int64) (UserDTO, error)
GetByRole(ctx context.Context, role string, filter ListFilter) (ListUserDTO, error)
Create(ctx context.Context, dto CreateUserDTO, roleID int64) (UserDTO, error)
Update(ctx context.Context, id int64, dto UpdateUserDTO, roleID int64) (UserDTO, error)
SetRole(ctx context.Context, id, roleID int64) error
Delete(ctx context.Context, id int64) error
// RoleByCode / RoleByID return nil when no live role matches.
RoleByCode(ctx context.Context, code string) (*rbac.RoleInfo, error)
RoleByID(ctx context.Context, id int64) (*rbac.RoleInfo, error)
// RoleOfUser returns the user's current role, nil if the user is gone.
RoleOfUser(ctx context.Context, userID int64) (*rbac.RoleInfo, error)
// CountSuperUsers counts live users holding an is_super role.
CountSuperUsers(ctx context.Context) (int64, error)
}