RezinaLMS-BackEnd/internal/ports/lms_practice.go
2026-06-18 04:14:34 -07:00

32 lines
1.7 KiB
Go

package ports
import (
"Yimaru-Backend/internal/domain"
"context"
)
// QuestionSetByID is implemented by the questions store.
type QuestionSetByID interface {
GetQuestionSetByID(ctx context.Context, id int64) (domain.QuestionSet, error)
}
// UserByID is implemented by the user store.
type UserByID interface {
GetUserByID(ctx context.Context, id int64) (domain.User, error)
}
type LmsPracticeStore interface {
CreateLmsPractice(ctx context.Context, in domain.CreatePracticeInput, parents []domain.PracticeParent) (domain.Practice, error)
GetLmsPracticeByID(ctx context.Context, id int64) (domain.Practice, error)
// TryGetLmsPracticeByQuestionSetID returns false when no LMS practice row references the question set.
TryGetLmsPracticeByQuestionSetID(ctx context.Context, questionSetID int64) (domain.Practice, bool, error)
ListLmsPracticesByCourseID(ctx context.Context, courseID int64, publishedOnly bool, limit, offset int32) ([]domain.Practice, int64, error)
ListLmsPracticesByModuleID(ctx context.Context, moduleID int64, publishedOnly bool, limit, offset int32) ([]domain.Practice, int64, error)
ListLmsPracticesByLessonID(ctx context.Context, lessonID int64, publishedOnly bool, limit, offset int32) ([]domain.Practice, int64, error)
UpdateLmsPractice(ctx context.Context, id int64, input domain.UpdatePracticeInput) (domain.Practice, error)
ReplaceLmsPracticeParents(ctx context.Context, practiceID int64, parents []domain.PracticeParent) error
DeleteLmsPractice(ctx context.Context, id int64) error
CountLmsPracticesByParent(ctx context.Context, kind domain.ParentKind, parentID int64) (int64, error)
CountLmsPracticesByParentExcludingPractice(ctx context.Context, kind domain.ParentKind, parentID, practiceID int64) (int64, error)
}