Documentation ¶
Index ¶
- type CourseClient
- type DeletedMatrix
- type Matrix
- type MatrixFilters
- type MatrixRepository
- type MatrixSubject
- type Service
- func (s *Service) AddSubject(_ context.Context, matrixSubject *MatrixSubject) error
- func (s *Service) CourseMatrixExists(_ context.Context, courseUUID uuid.UUID, matrixUUID uuid.UUID) (bool, error)
- func (s *Service) CreateMatrix(ctx context.Context, matrix *Matrix) error
- func (s *Service) CreateSubject(_ context.Context, sub *Subject) error
- func (s *Service) DeleteMatrix(_ context.Context, matrix *DeletedMatrix) error
- func (s *Service) DeleteSubject(_ context.Context, id uuid.UUID) error
- func (s *Service) Matrices(_ context.Context, filters *MatrixFilters) ([]Matrix, error)
- func (s *Service) Matrix(_ context.Context, matrixUUID uuid.UUID) (Matrix, error)
- func (s *Service) RemoveSubject(_ context.Context, matrixUUID, subjectUUID uuid.UUID) error
- func (s *Service) Subject(_ context.Context, id uuid.UUID) (Subject, error)
- func (s *Service) Subjects(_ context.Context) ([]Subject, error)
- func (s *Service) UpdateMatrix(_ context.Context, matrix *Matrix) error
- func (s *Service) UpdateSubject(_ context.Context, sub *Subject) error
- type ServiceConfiguration
- type ServiceInterface
- type Subject
- type SubjectRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CourseClient ¶
type DeletedMatrix ¶
type Matrix ¶
type Matrix struct { UUID uuid.UUID `db:"uuid" json:"uuid"` Code string `db:"code" json:"code"` Name string `db:"name" json:"name"` Description string `db:"description" json:"description"` CourseUUID uuid.UUID `db:"course_uuid" json:"course_uuid"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
type MatrixFilters ¶
type MatrixRepository ¶
type MatrixRepository interface { // CREATE. CreateMatrix(matrix *Matrix) error AddSubject(matrixSubject *MatrixSubject) error // READ. Matrix(matrixUUID uuid.UUID) (Matrix, error) CourseMatrixExists(courseUUID uuid.UUID, matrixUUID uuid.UUID) (bool, error) Matrices() ([]Matrix, error) CourseMatrices(courseUUID uuid.UUID) ([]Matrix, error) // UPDATE. UpdateMatrix(matrix *Matrix) error // DELETE. DeleteMatrix(matrix *DeletedMatrix) error RemoveSubject(matrixUUID, subjectUUID uuid.UUID) error }
type MatrixSubject ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(cfgs ...ServiceConfiguration) (*Service, error)
NewService creates a new domain Service instance.
func (*Service) AddSubject ¶
func (s *Service) AddSubject(_ context.Context, matrixSubject *MatrixSubject) error
func (*Service) CourseMatrixExists ¶
func (*Service) CreateMatrix ¶
func (*Service) CreateSubject ¶
func (*Service) DeleteMatrix ¶
func (s *Service) DeleteMatrix(_ context.Context, matrix *DeletedMatrix) error
func (*Service) DeleteSubject ¶
func (*Service) RemoveSubject ¶
func (*Service) UpdateMatrix ¶
type ServiceConfiguration ¶
func WithCourseClient ¶
func WithCourseClient(courses CourseClient) ServiceConfiguration
func WithLogger ¶
func WithLogger(l log.Logger) ServiceConfiguration
WithLogger injects the logger to the domain Service.
func WithMatrixRepository ¶
func WithMatrixRepository(cr MatrixRepository) ServiceConfiguration
WithMatrixRepository injects the course repository to the domain Service.
func WithSubjectRepository ¶
func WithSubjectRepository(sr SubjectRepository) ServiceConfiguration
WithSubjectRepository injects the subscription repository to the domain Service.
type ServiceInterface ¶
type ServiceInterface interface { Matrix(ctx context.Context, matrixUUID uuid.UUID) (Matrix, error) CourseMatrixExists(ctx context.Context, courseUUID uuid.UUID, matrixUUID uuid.UUID) (bool, error) Matrices(ctx context.Context, filters *MatrixFilters) ([]Matrix, error) CreateMatrix(ctx context.Context, matrix *Matrix) error UpdateMatrix(ctx context.Context, matrix *Matrix) error DeleteMatrix(ctx context.Context, matrix *DeletedMatrix) error AddSubject(ctx context.Context, matrixSubject *MatrixSubject) error RemoveSubject(ctx context.Context, matrixID, SubjectID uuid.UUID) error Subject(ctx context.Context, id uuid.UUID) (Subject, error) Subjects(ctx context.Context) ([]Subject, error) CreateSubject(ctx context.Context, subject *Subject) error UpdateSubject(ctx context.Context, subject *Subject) error DeleteSubject(ctx context.Context, id uuid.UUID) error }
type Subject ¶
type Subject struct { ID uint `json:"id"` UUID uuid.UUID `json:"uuid"` Code string `json:"code"` Name string `json:"name"` Objective string `json:"objective"` Credit float32 `json:"credit"` Workload float32 `json:"workload"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` DeletedAt *time.Time `db:"deleted_at" json:"deleted_at"` }
Subject struct.
Click to show internal directories.
Click to hide internal directories.