This commit is contained in:
@@ -24,10 +24,10 @@ type RoleRepository interface {
|
||||
Update(ctx context.Context, params sqlc.UpdateRoleParams) (*models.RoleEntity, error)
|
||||
Delete(ctx context.Context, id pgtype.UUID) error
|
||||
Restore(ctx context.Context, id pgtype.UUID) error
|
||||
AddUserRole(ctx context.Context, params sqlc.AddUserRoleParams) error
|
||||
RemoveUserRole(ctx context.Context, params sqlc.RemoveUserRoleParams) error
|
||||
RemoveAllRolesFromUser(ctx context.Context, userId pgtype.UUID) error
|
||||
RemoveAllUsersFromRole(ctx context.Context, roleId pgtype.UUID) error
|
||||
CreateUserRole(ctx context.Context, params sqlc.CreateUserRoleParams) error
|
||||
DeleteUserRole(ctx context.Context, params sqlc.DeleteUserRoleParams) error
|
||||
BulkDeleteRolesFromUser(ctx context.Context, userId pgtype.UUID) error
|
||||
BulkDeleteUsersFromRole(ctx context.Context, roleId pgtype.UUID) error
|
||||
}
|
||||
|
||||
type roleRepository struct {
|
||||
@@ -261,22 +261,22 @@ func (r *roleRepository) Restore(ctx context.Context, id pgtype.UUID) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *roleRepository) AddUserRole(ctx context.Context, params sqlc.AddUserRoleParams) error {
|
||||
err := r.q.AddUserRole(ctx, params)
|
||||
func (r *roleRepository) CreateUserRole(ctx context.Context, params sqlc.CreateUserRoleParams) error {
|
||||
err := r.q.CreateUserRole(ctx, params)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *roleRepository) RemoveUserRole(ctx context.Context, params sqlc.RemoveUserRoleParams) error {
|
||||
err := r.q.RemoveUserRole(ctx, params)
|
||||
func (r *roleRepository) DeleteUserRole(ctx context.Context, params sqlc.DeleteUserRoleParams) error {
|
||||
err := r.q.DeleteUserRole(ctx, params)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *roleRepository) RemoveAllUsersFromRole(ctx context.Context, roleId pgtype.UUID) error {
|
||||
err := r.q.RemoveAllUsersFromRole(ctx, roleId)
|
||||
func (r *roleRepository) BulkDeleteUsersFromRole(ctx context.Context, roleId pgtype.UUID) error {
|
||||
err := r.q.BulkDeleteUsersFromRole(ctx, roleId)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *roleRepository) RemoveAllRolesFromUser(ctx context.Context, roleId pgtype.UUID) error {
|
||||
err := r.q.RemoveAllRolesFromUser(ctx, roleId)
|
||||
func (r *roleRepository) BulkDeleteRolesFromUser(ctx context.Context, roleId pgtype.UUID) error {
|
||||
err := r.q.BulkDeleteRolesFromUser(ctx, roleId)
|
||||
return err
|
||||
}
|
||||
|
||||
32
internal/repositories/verificationRepository.go
Normal file
32
internal/repositories/verificationRepository.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
"history-api/internal/gen/sqlc"
|
||||
"history-api/internal/models"
|
||||
"history-api/pkg/cache"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type VerificationRepository interface {
|
||||
GetByID(ctx context.Context, id pgtype.UUID) (*models.UserVerificationEntity, error)
|
||||
GetByUserID(ctx context.Context, id pgtype.UUID) ([]*models.UserVerificationEntity, error)
|
||||
Count(ctx context.Context, params sqlc.CountUserVerificationsParams) (int64, error)
|
||||
Search(ctx context.Context, params sqlc.SearchUserVerificationsParams) ([]*models.UserVerificationEntity, error)
|
||||
Delete(ctx context.Context, id pgtype.UUID) error
|
||||
CreateVerificationMedia(ctx context.Context, params sqlc.CreateVerificationMediaParams) error
|
||||
DeleteVerificationMedia(ctx context.Context, params sqlc.DeleteVerificationMediasParams) error
|
||||
}
|
||||
|
||||
type verificationRepository struct {
|
||||
q *sqlc.Queries
|
||||
c cache.Cache
|
||||
}
|
||||
|
||||
// func NewVerificationRepository(db sqlc.DBTX, c cache.Cache) VerificationRepository {
|
||||
// return &verificationRepository{
|
||||
// q: sqlc.New(db),
|
||||
// c: c,
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user