From 32b99f4f112dc36c3247342fe9484f178a912d68 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Thu, 12 Dec 2024 23:51:13 +0300 Subject: [PATCH] feat: add task type --- .gitignore | 4 +++- internal/models/db.go | 11 +++++++++++ internal/services/taskservice/create.go | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c7348ad..a450265 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,6 @@ fabric.properties .idea/**/azureSettings.xml # Игнорируем папку uploads -uploads \ No newline at end of file +uploads + +app.db \ No newline at end of file diff --git a/internal/models/db.go b/internal/models/db.go index 0a95f9b..6529ca6 100644 --- a/internal/models/db.go +++ b/internal/models/db.go @@ -29,11 +29,22 @@ const ( StatusCancelled // 4 ) +type TaskType int + +const ( + // For future purpose + TypeTestOnly TaskType = iota // 0 + TypeUpsert // 1 + // For future purpose + TypeDelete // 2 +) + type Task struct { gorm.Model ID int Status TaskStatus + Type TaskType RepoID int Repo GitRepo diff --git a/internal/services/taskservice/create.go b/internal/services/taskservice/create.go index 8b32f12..d178359 100644 --- a/internal/services/taskservice/create.go +++ b/internal/services/taskservice/create.go @@ -16,6 +16,7 @@ func (s *Service) Create(repo string) (*models.Task, error) { task := models.Task{ RepoID: taskRepo.ID, ALTRepo: altRepo, + Type: models.TypeUpsert, } result := s.app.Db.Create(&task)