fix
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/dusiburg/kotosoft-id/internal/models"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const adminPositionCode = "PRESIDENT"
|
||||
|
||||
func (s *Service) GetUserPositions(ctx context.Context, userID uuid.UUID, locale string) ([]models.PositionLocalized, error) {
|
||||
if locale == "" {
|
||||
locale = "en"
|
||||
}
|
||||
return s.positions.GetUserPositions(ctx, userID, locale)
|
||||
}
|
||||
|
||||
func (s *Service) GetAllPositions(ctx context.Context, locale string) ([]models.PositionLocalized, error) {
|
||||
if locale == "" {
|
||||
locale = "en"
|
||||
}
|
||||
return s.positions.GetAllPositions(ctx, locale)
|
||||
}
|
||||
|
||||
func (s *Service) UpsertPositionForLocale(ctx context.Context, code, locale, name string, description *string) error {
|
||||
if locale == "" {
|
||||
locale = "en"
|
||||
}
|
||||
return s.positions.UpsertPositionForLocale(ctx, code, locale, name, description)
|
||||
}
|
||||
|
||||
func (s *Service) UserIsPositionsAdmin(ctx context.Context, userID uuid.UUID) (bool, error) {
|
||||
return s.positions.UserHasPosition(ctx, userID, adminPositionCode)
|
||||
}
|
||||
Reference in New Issue
Block a user