64 lines
1.3 KiB
Go
64 lines
1.3 KiB
Go
package course_management
|
|
|
|
import (
|
|
"Yimaru-Backend/internal/domain"
|
|
"context"
|
|
)
|
|
|
|
func (s *Service) CreateLevel(
|
|
ctx context.Context,
|
|
programID int64,
|
|
title string,
|
|
description *string,
|
|
levelIndex int,
|
|
isActive *bool,
|
|
) (domain.Level, error) {
|
|
return s.courseStore.CreateLevel(ctx, programID, title, description, levelIndex, isActive)
|
|
}
|
|
|
|
func (s *Service) GetLevelsByProgram(
|
|
ctx context.Context,
|
|
programID int64,
|
|
) ([]domain.Level, error) {
|
|
return s.courseStore.GetLevelsByProgram(ctx, programID)
|
|
}
|
|
|
|
func (s *Service) UpdateLevel(
|
|
ctx context.Context,
|
|
id int64,
|
|
title *string,
|
|
description *string,
|
|
levelIndex *int,
|
|
isActive *bool,
|
|
) error {
|
|
return s.courseStore.UpdateLevel(ctx, id, title, description, levelIndex, isActive)
|
|
}
|
|
|
|
func (s *Service) IncrementLevelModuleCount(
|
|
ctx context.Context,
|
|
levelID int64,
|
|
) error {
|
|
return s.courseStore.IncrementLevelModuleCount(ctx, levelID)
|
|
}
|
|
|
|
func (s *Service) IncrementLevelPracticeCount(
|
|
ctx context.Context,
|
|
levelID int64,
|
|
) error {
|
|
return s.courseStore.IncrementLevelPracticeCount(ctx, levelID)
|
|
}
|
|
|
|
func (s *Service) IncrementLevelVideoCount(
|
|
ctx context.Context,
|
|
levelID int64,
|
|
) error {
|
|
return s.courseStore.IncrementLevelVideoCount(ctx, levelID)
|
|
}
|
|
|
|
func (s *Service) DeleteLevel(
|
|
ctx context.Context,
|
|
levelID int64,
|
|
) error {
|
|
return s.courseStore.DeleteLevel(ctx, levelID)
|
|
}
|