42 lines
842 B
Go
42 lines
842 B
Go
package course_management
|
|
|
|
import (
|
|
"Yimaru-Backend/internal/domain"
|
|
"context"
|
|
)
|
|
|
|
func (s *Service) CreateModule(
|
|
ctx context.Context,
|
|
levelID int64,
|
|
title string,
|
|
content *string,
|
|
displayOrder *int32,
|
|
) (domain.Module, error) {
|
|
return s.courseStore.CreateModule(ctx, levelID, title, content, displayOrder)
|
|
}
|
|
|
|
func (s *Service) GetModulesByLevel(
|
|
ctx context.Context,
|
|
levelID int64,
|
|
) ([]domain.Module, int64, error) {
|
|
return s.courseStore.GetModulesByLevel(ctx, levelID)
|
|
}
|
|
|
|
func (s *Service) UpdateModule(
|
|
ctx context.Context,
|
|
id int64,
|
|
title *string,
|
|
content *string,
|
|
displayOrder *int32,
|
|
isActive *bool,
|
|
) error {
|
|
return s.courseStore.UpdateModule(ctx, id, title, content, displayOrder, isActive)
|
|
}
|
|
|
|
func (s *Service) DeleteModule(
|
|
ctx context.Context,
|
|
id int64,
|
|
) error {
|
|
return s.courseStore.DeleteModule(ctx, id)
|
|
}
|