fixes
This commit is contained in:
@@ -39,6 +39,26 @@ func (r *PositionRepository) GetAllPermissions(ctx context.Context) ([]models.Pe
|
||||
return result, rows.Err()
|
||||
}
|
||||
|
||||
func (r *PositionRepository) CreatePermission(ctx context.Context, code string, description *string) error {
|
||||
_, err := r.db.Exec(ctx, `
|
||||
INSERT INTO permissions (code, description)
|
||||
VALUES ($1, $2)
|
||||
`, code, description)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *PositionRepository) UpdatePermission(ctx context.Context, code string, description *string) error {
|
||||
_, err := r.db.Exec(ctx, `
|
||||
UPDATE permissions SET description = $2 WHERE code = $1
|
||||
`, code, description)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *PositionRepository) DeletePermission(ctx context.Context, code string) error {
|
||||
_, err := r.db.Exec(ctx, `DELETE FROM permissions WHERE code = $1`, code)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *PositionRepository) GetPermissionByCode(ctx context.Context, code string) (*models.Permission, error) {
|
||||
var p models.Permission
|
||||
err := r.db.QueryRow(ctx, `
|
||||
@@ -208,6 +228,11 @@ func (r *PositionRepository) UpsertPositionForLocale(ctx context.Context, code,
|
||||
return tx.Commit(ctx)
|
||||
}
|
||||
|
||||
func (r *PositionRepository) DeletePositionByCode(ctx context.Context, code string) error {
|
||||
_, err := r.db.Exec(ctx, `DELETE FROM positions WHERE code = $1`, code)
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *PositionRepository) AssignPosition(ctx context.Context, userID, positionID uuid.UUID, assignedBy *uuid.UUID, validFrom interface{}, validTo *interface{}) error {
|
||||
_, err := r.db.Exec(ctx, `
|
||||
INSERT INTO user_positions (user_id, position_id, assigned_by, valid_from, valid_to)
|
||||
|
||||
Reference in New Issue
Block a user