domain

package
v0.0.0-...-0a842c9 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithClassroomRepository

func WithClassroomRepository(cr ClassroomRepository) serviceConfiguration

WithClassroomRepository injects the course repository to the domain Service

func WithLogger

func WithLogger(l log.Logger) serviceConfiguration

WithLogger injects the logger to the domain Service

func WithSubscriptionRepository

func WithSubscriptionRepository(sr SubscriptionRepository) serviceConfiguration

WithSubscriptionRepository injects the course repository to the domain Service

Types

type Classroom

type Classroom struct {
	ID           uint       `json:"id"`
	UUID         uuid.UUID  `json:"uuid"`
	Code         string     `json:"code"`
	Name         string     `json:"name"`
	Description  string     `json:"description"`
	Format       string     `json:"format"`
	CanSubscribe bool       `db:"can_subscribe" json:"can_subscribe"`
	SubjectID    *uuid.UUID `db:"subject_id" json:"subject_id"`
	CourseID     uuid.UUID  `db:"course_id" json:"course_id"`
	StartsAt     time.Time  `db:"starts_at" json:"starts_at"`
	EndsAt       *time.Time `db:"ends_at" json:"ends_at"`
	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"`
}

type ClassroomLesson

type ClassroomLesson struct {
	ID               uint       `json:"id"`
	UUID             uuid.UUID  `json:"uuid"`
	ClassroomID      uuid.UUID  `db:"classroom_id" json:"classroom_id"`
	SyllabusLessonID uuid.UUID  `db:"syllabus_lessons_id" json:"syllabus_lessons_id"`
	StartsAt         time.Time  `db:"starts_at" json:"starts_at"`
	EndsAt           *time.Time `db:"ends_at" json:"ends_at"`
}

type ClassroomRepository

type ClassroomRepository interface {
	Classroom(id uuid.UUID) (Classroom, error)
	Classrooms() ([]Classroom, error)
	CreateClassroom(classroom *Classroom) (Classroom, error)
	UpdateClassroom(classroom *Classroom) (Classroom, error)
	DeleteClassroom(id uuid.UUID) error
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(cfgs ...serviceConfiguration) (*Service, error)

func (*Service) AddLesson

func (s *Service) AddLesson(ctx context.Context, classroomID, lessonID uuid.UUID) error

func (*Service) Classroom

func (s *Service) Classroom(_ context.Context, id uuid.UUID) (Classroom, error)

func (*Service) Classrooms

func (s *Service) Classrooms(_ context.Context) ([]Classroom, error)

func (*Service) CreateClassroom

func (s *Service) CreateClassroom(_ context.Context, classroom *Classroom) (Classroom, error)

func (*Service) CreateSubscription

func (s *Service) CreateSubscription(_ context.Context, subscription *Subscription) (Subscription, error)

func (*Service) DeleteClassroom

func (s *Service) DeleteClassroom(_ context.Context, id uuid.UUID) error

func (*Service) DeleteSubscription

func (s *Service) DeleteSubscription(ctx context.Context, id uuid.UUID) error

func (*Service) FindSubscription

func (s *Service) FindSubscription(_ context.Context, id uuid.UUID) (Subscription, error)

func (*Service) ListSubscription

func (s *Service) ListSubscription(_ context.Context) ([]Subscription, error)

func (*Service) RemoveLesson

func (s *Service) RemoveLesson(ctx context.Context, classroomID, lessonID uuid.UUID) error

func (*Service) Subscription

func (s *Service) Subscription(ctx context.Context, id uuid.UUID) (Subscription, error)

func (*Service) Subscriptions

func (s *Service) Subscriptions(ctx context.Context) ([]Subscription, error)

func (*Service) UpdateClassroom

func (s *Service) UpdateClassroom(_ context.Context, classroom *Classroom) (Classroom, error)

func (*Service) UpdateSubscription

func (s *Service) UpdateSubscription(_ context.Context, subscription *Subscription) (Subscription, error)

type ServiceInterface

type ServiceInterface interface {
	Classroom(ctx context.Context, id uuid.UUID) (Classroom, error)
	Classrooms(ctx context.Context) ([]Classroom, error)
	CreateClassroom(ctx context.Context, classroom *Classroom) (Classroom, error)
	UpdateClassroom(ctx context.Context, classroom *Classroom) (Classroom, error)
	DeleteClassroom(ctx context.Context, id uuid.UUID) error
	AddLesson(ctx context.Context, classroomID, lessonID uuid.UUID) error
	RemoveLesson(ctx context.Context, classroomID, lessonID uuid.UUID) error

	Subscription(ctx context.Context, id uuid.UUID) (Subscription, error)
	Subscriptions(ctx context.Context) ([]Subscription, error)
	CreateSubscription(ctx context.Context, subscription *Subscription) (Subscription, error)
	UpdateSubscription(ctx context.Context, subscription *Subscription) (Subscription, error)
	DeleteSubscription(ctx context.Context, id uuid.UUID) error
}

type Subscription

type Subscription struct {
	ID          uint       `json:"id"`
	UUID        uuid.UUID  `json:"uuid"`
	UserID      uuid.UUID  `json:"user_id"`
	ClassroomID uuid.UUID  `json:"classroom_id"`
	Role        string     `json:"role"`
	ExpiresAt   *time.Time `json:"expires_at"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	DeletedAt   *time.Time `json:"deleted_at"`
}

type SubscriptionRepository

type SubscriptionRepository interface {
	Subscription(id uuid.UUID) (Subscription, error)
	Subscriptions() ([]Subscription, error)
	CreateSubscription(subscription *Subscription) (Subscription, error)
	UpdateSubscription(subscription *Subscription) (Subscription, error)
	DeleteSubscription(id uuid.UUID) error
}

Jump to

Keyboard shortcuts

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