78 lines
1.7 KiB
Go
78 lines
1.7 KiB
Go
package course_management
|
|
|
|
import (
|
|
"Yimaru-Backend/internal/domain"
|
|
"context"
|
|
)
|
|
|
|
func (s *Service) CreateProgram(
|
|
ctx context.Context,
|
|
courseID int64,
|
|
title string,
|
|
description *string,
|
|
thumbnail *string,
|
|
displayOrder *int32,
|
|
) (domain.Program, error) {
|
|
return s.courseStore.CreateProgram(ctx, courseID, title, description, thumbnail, displayOrder)
|
|
}
|
|
|
|
func (s *Service) GetProgramByID(
|
|
ctx context.Context,
|
|
id int64,
|
|
) (domain.Program, error) {
|
|
return s.courseStore.GetProgramByID(ctx, id)
|
|
}
|
|
|
|
func (s *Service) GetProgramsByCourse(
|
|
ctx context.Context,
|
|
courseID int64,
|
|
) ([]domain.Program, int64, error) {
|
|
return s.courseStore.GetProgramsByCourse(ctx, courseID)
|
|
}
|
|
|
|
func (s *Service) ListProgramsByCourse(
|
|
ctx context.Context,
|
|
courseID int64,
|
|
) ([]domain.Program, error) {
|
|
return s.courseStore.ListProgramsByCourse(ctx, courseID)
|
|
}
|
|
|
|
func (s *Service) ListActivePrograms(
|
|
ctx context.Context,
|
|
) ([]domain.Program, error) {
|
|
return s.courseStore.ListActivePrograms(ctx)
|
|
}
|
|
|
|
func (s *Service) UpdateProgramPartial(
|
|
ctx context.Context,
|
|
id int64,
|
|
title *string,
|
|
description *string,
|
|
thumbnail *string,
|
|
displayOrder *int32,
|
|
isActive *bool,
|
|
) error {
|
|
return s.courseStore.UpdateProgramPartial(ctx, id, title, description, thumbnail, displayOrder, isActive)
|
|
}
|
|
|
|
func (s *Service) UpdateProgramFull(
|
|
ctx context.Context,
|
|
program domain.Program,
|
|
) (domain.Program, error) {
|
|
return s.courseStore.UpdateProgramFull(ctx, program)
|
|
}
|
|
|
|
func (s *Service) DeactivateProgram(
|
|
ctx context.Context,
|
|
id int64,
|
|
) error {
|
|
return s.courseStore.DeactivateProgram(ctx, id)
|
|
}
|
|
|
|
func (s *Service) DeleteProgram(
|
|
ctx context.Context,
|
|
id int64,
|
|
) (domain.Program, error) {
|
|
return s.courseStore.DeleteProgram(ctx, id)
|
|
}
|