From a5392a9f1ec3a37863224919a72bb3fff2419461 Mon Sep 17 00:00:00 2001 From: Andrea Fazzi Date: Wed, 18 Oct 2023 13:40:21 +0200 Subject: [PATCH] Add models for Exam --- models/exam.go | 13 +++++++++++++ models/participant.go | 8 ++++++++ store/db/db.go | 9 +++++++++ store/db/db.go~ | 9 +++++++++ store/db/db_test.go | 24 ++++++++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 models/exam.go create mode 100644 models/participant.go create mode 100644 store/db/db.go create mode 100644 store/db/db.go~ create mode 100644 store/db/db_test.go diff --git a/models/exam.go b/models/exam.go new file mode 100644 index 0000000..0913abb --- /dev/null +++ b/models/exam.go @@ -0,0 +1,13 @@ +package models + +import "time" + +type Exam struct { + ID string `gorm:"primaryKey"` + CreatedAt time.Time + + Quizzes []*Quiz + Participant *Participant + + Responses []string +} diff --git a/models/participant.go b/models/participant.go new file mode 100644 index 0000000..d2e2238 --- /dev/null +++ b/models/participant.go @@ -0,0 +1,8 @@ +package models + +type Participant struct { + ID string + + Firstname string + Lastname string +} diff --git a/store/db/db.go b/store/db/db.go new file mode 100644 index 0000000..e2fdefc --- /dev/null +++ b/store/db/db.go @@ -0,0 +1,9 @@ +package db + +type DBProboCollectorStore struct { + Path string +} + +func NewDBProboCollectorStore(path string) (*DBProboCollectorStore, error) { + return nil, nil +} diff --git a/store/db/db.go~ b/store/db/db.go~ new file mode 100644 index 0000000..9c47ccd --- /dev/null +++ b/store/db/db.go~ @@ -0,0 +1,9 @@ +package db + +type DBProboCollectorStore struct { + Path string +} + +func (s *DBProboCollectorStore) NewDBProboCollectorStore(path string) (*DBProboCollectorStore, error) { + return nil, nil +} diff --git a/store/db/db_test.go b/store/db/db_test.go new file mode 100644 index 0000000..8793b1f --- /dev/null +++ b/store/db/db_test.go @@ -0,0 +1,24 @@ +package db + +import ( + "testing" + + "github.com/remogatto/prettytest" +) + +type dbTestSuite struct { + prettytest.Suite +} + +func TestRunner(t *testing.T) { + prettytest.Run( + t, + new(dbTestSuite), + ) +} + +func (t *dbTestSuite) TestCreateExam() { + store, err := NewDBProboCollectorStore("testdata/test.sqlite") + t.Nil(err) + t.Not(t.Nil(store)) +}