49 lines
989 B
Go
49 lines
989 B
Go
package course_management
|
|
|
|
import (
|
|
"Yimaru-Backend/internal/domain"
|
|
"context"
|
|
)
|
|
|
|
func (s *Service) CreateCourse(
|
|
ctx context.Context,
|
|
categoryID int64,
|
|
title string,
|
|
description *string,
|
|
) (domain.Course, error) {
|
|
return s.courseStore.CreateCourse(ctx, categoryID, title, description)
|
|
}
|
|
|
|
func (s *Service) GetCourseByID(
|
|
ctx context.Context,
|
|
id int64,
|
|
) (domain.Course, error) {
|
|
return s.courseStore.GetCourseByID(ctx, id)
|
|
}
|
|
|
|
func (s *Service) GetCoursesByCategory(
|
|
ctx context.Context,
|
|
categoryID int64,
|
|
limit int32,
|
|
offset int32,
|
|
) ([]domain.Course, int64, error) {
|
|
return s.courseStore.GetCoursesByCategory(ctx, categoryID, limit, offset)
|
|
}
|
|
|
|
func (s *Service) UpdateCourse(
|
|
ctx context.Context,
|
|
id int64,
|
|
title *string,
|
|
description *string,
|
|
isActive *bool,
|
|
) error {
|
|
return s.courseStore.UpdateCourse(ctx, id, title, description, isActive)
|
|
}
|
|
|
|
func (s *Service) DeleteCourse(
|
|
ctx context.Context,
|
|
id int64,
|
|
) error {
|
|
return s.courseStore.DeleteCourse(ctx, id)
|
|
}
|