production

package
v0.0.0-...-82802e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

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 New

func New(store store.Store, cfg *config.Config, log *zap.Logger) *Service

New ...

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) GetMe

func (s *Service) GetMe(ctx context.Context, user uuid.UUID) (*model.GetMeResponse, error)

GetMe ...

func (*Service) GetTask

func (s *Service) GetTask(ctx context.Context, user, task uuid.UUID) (*model.Task, error)

GetTask return task by user and task id.

func (*Service) GetUserFromToken

func (s *Service) GetUserFromToken(ctx context.Context, t string) (uuid.UUID, error)

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) Ping

func (s *Service) Ping(ctx context.Context) error

Ping ...

func (*Service) RegisterUser

func (s *Service) RegisterUser(ctx context.Context, email, password string) (*model.User, error)

RegisterUser ...

func (*Service) UseInvite

func (s *Service) UseInvite(ctx context.Context, user uuid.UUID, group uuid.UUID, invite uuid.UUID) error

UseInvite check

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL