feat/add-database #8

Merged
maks1ms merged 9 commits from feat/add-database into main 2024-12-14 08:40:46 +00:00
3 changed files with 15 additions and 1 deletions
Showing only changes of commit 32b99f4f11 - Show all commits

4
.gitignore vendored
View file

@ -129,4 +129,6 @@ fabric.properties
.idea/**/azureSettings.xml .idea/**/azureSettings.xml
# Игнорируем папку uploads # Игнорируем папку uploads
uploads uploads
app.db

View file

@ -29,11 +29,22 @@ const (
StatusCancelled // 4 StatusCancelled // 4
) )
type TaskType int
const (
// For future purpose
TypeTestOnly TaskType = iota // 0
TypeUpsert // 1
// For future purpose
TypeDelete // 2
)
type Task struct { type Task struct {
gorm.Model gorm.Model
ID int ID int
Status TaskStatus Status TaskStatus
Type TaskType
RepoID int RepoID int
Repo GitRepo Repo GitRepo

View file

@ -16,6 +16,7 @@ func (s *Service) Create(repo string) (*models.Task, error) {
task := models.Task{ task := models.Task{
RepoID: taskRepo.ID, RepoID: taskRepo.ID,
ALTRepo: altRepo, ALTRepo: altRepo,
Type: models.TypeUpsert,
} }
result := s.app.Db.Create(&task) result := s.app.Db.Create(&task)