probo/store/store.go

60 lines
1.9 KiB
Go

package store
import (
"git.andreafazzi.eu/andrea/probo/client"
"git.andreafazzi.eu/andrea/probo/models"
)
type QuizReader interface {
ReadAllQuizzes() ([]*models.Quiz, error)
ReadQuizByID(id string) (*models.Quiz, error)
ReadQuizByHash(hash string) (*models.Quiz, error)
}
type QuizWriter interface {
CreateQuiz(r *client.CreateUpdateQuizRequest) (*models.Quiz, error)
UpdateQuiz(r *client.CreateUpdateQuizRequest, id string) (*models.Quiz, bool, error)
DeleteQuiz(r *client.DeleteQuizRequest) (*models.Quiz, error)
}
type CollectionReader interface {
ReadAllCollections() ([]*models.Collection, error)
ReadCollectionByID(id string) (*models.Collection, error)
}
type CollectionWriter interface {
CreateCollection(r *client.CreateUpdateCollectionRequest) (*models.Collection, error)
UpdateCollection(r *client.CreateUpdateCollectionRequest, id string) (*models.Collection, bool, error)
DeleteCollection(r *client.DeleteCollectionRequest) (*models.Collection, error)
}
type ParticipantReader interface {
ReadAllParticipants() ([]*models.Participant, error)
ReadParticipantByID(id string) (*models.Participant, error)
}
type ParticipantWriter interface {
CreateParticipant(r *client.CreateUpdateParticipantRequest) (*models.Participant, error)
UpdateParticipant(r *client.CreateUpdateParticipantRequest, id string) (*models.Participant, bool, error)
DeleteParticipant(r *client.DeleteParticipantRequest) (*models.Participant, error)
}
type ExamReader interface {
ReadAllExams() ([]*models.Exam, error)
ReadExamByID(id string) (*models.Exam, error)
}
type ExamWriter interface {
CreateExam(r *client.CreateUpdateExamRequest) (*models.Exam, error)
UpdateExam(r *client.CreateUpdateExamRequest, id string) (*models.Exam, bool, error)
DeleteExam(r *client.DeleteExamRequest) (*models.Exam, error)
}
type ProboCollectorStore interface {
QuizReader
QuizWriter
CollectionReader
CollectionWriter
ParticipantReader
ParticipantWriter
}