Documentation ¶
Index ¶
- Constants
- Variables
- type Service
- func (s *Service) CreateGroup(ctx context.Context, user uuid.UUID, name, description string) (*model.CreateGroupResponse, error)
- func (s *Service) CreateInvite(ctx context.Context, user uuid.UUID, group uuid.UUID, role *model.Role, ...) (*model.CreateInviteResponse, error)
- func (s *Service) CreateTask(ctx context.Context, user uuid.UUID, req model.TaskCreateRequest) (*model.Task, error)
- func (s *Service) CreateToken(ctx context.Context, email, password, token string) (*model.CreateTokenResponse, error)
- func (s *Service) GetMe(ctx context.Context, user uuid.UUID) (*model.GetMeResponse, error)
- func (s *Service) GetTask(ctx context.Context, user, task uuid.UUID) (*model.Task, error)
- func (s *Service) GetUserFromToken(ctx context.Context, t string) (uuid.UUID, error)
- func (s *Service) GetUserTasks(ctx context.Context, user uuid.UUID) (*model.GetTasksResponse, error)
- func (s *Service) Ping(ctx context.Context) error
- func (s *Service) RegisterUser(ctx context.Context, email, password string) (*model.User, error)
- func (s *Service) UseInvite(ctx context.Context, user uuid.UUID, group uuid.UUID, invite uuid.UUID) error
Constants ¶
View Source
const ( BearerToken = "bearer" JWTToken = "jwt" AuthorizationToken = "authorization" AuthToken = "auth" )
Variables ¶
View Source
var ( TestUser1 = &model.User{ ID: uuid.New(), Email: "user1@test.com", Pass: "some pass", } TestGroup1 = &model.Group{ ID: uuid.New(), Name: "test group 1", Owner: TestUser1.ID, Description: "test description", CreatedAt: time.Now(), } TestTask1 = &model.Task{ ID: uuid.New(), Name: uuid.NewString(), Description: uuid.NewString(), CreatedAt: time.Now(), CreatedBy: TestUser1.ID, Status: uuid.NewString(), } ReadOnlyRole = &model.Role{ ID: 0, Members: model.PermReadRelated, Tasks: model.PermReadRelated, Reviews: model.PermReadRelated, Comments: model.PermReadRelated, } SudoRole = &model.Role{ ID: 0, Members: model.PermChangeAll, Tasks: model.PermChangeAll, Reviews: model.PermChangeAll, Comments: model.PermChangeAll, } )
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service ... TODO:decompose logic as in storage - user, group, ...
func (*Service) CreateGroup ¶
func (s *Service) CreateGroup(ctx context.Context, user uuid.UUID, name, description string) (*model.CreateGroupResponse, error)
CreateGroup creates group in storage and prepares response to user.
func (*Service) CreateInvite ¶
func (s *Service) CreateInvite(ctx context.Context, user uuid.UUID, group uuid.UUID, role *model.Role, limit int) (*model.CreateInviteResponse, error)
CreateInvite ...
func (*Service) CreateTask ¶
func (s *Service) CreateTask(ctx context.Context, user uuid.UUID, req model.TaskCreateRequest) (*model.Task, error)
CreateTask create record about task in database.
func (*Service) CreateToken ¶
func (s *Service) CreateToken(ctx context.Context, email, password, token string) (*model.CreateTokenResponse, error)
CreateToken ...
func (*Service) GetUserFromToken ¶
GetUserFromToken parses jwt token from raw token string.
func (*Service) GetUserTasks ¶
func (s *Service) GetUserTasks(ctx context.Context, user uuid.UUID) (*model.GetTasksResponse, error)
GetUserTasks return tasks related to user with provided id.
func (*Service) RegisterUser ¶
RegisterUser ...
Click to show internal directories.
Click to hide internal directories.