TP-55555 | Release handler
This commit is contained in:
@@ -9,3 +9,8 @@ func InitProjectRepository(dbClient *gorm.DB) *gorm.DB {
|
||||
dbClient.AutoMigrate(&db.Project{})
|
||||
return dbClient
|
||||
}
|
||||
|
||||
func InitReleaseRepository(dbClient *gorm.DB) *gorm.DB {
|
||||
dbClient.AutoMigrate(&db.Release{})
|
||||
return dbClient
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ type Handler struct {
|
||||
|
||||
type Repositories struct {
|
||||
ProjectRepository *gorm.DB
|
||||
ReleaseRepository *gorm.DB
|
||||
}
|
||||
|
||||
func InitDependencies() *Dependencies {
|
||||
@@ -53,6 +54,7 @@ func initServices() *Service {
|
||||
func initRepositories(dbClient *gorm.DB) *Repositories {
|
||||
return &Repositories{
|
||||
ProjectRepository: database.InitProjectRepository(dbClient),
|
||||
ReleaseRepository: database.InitReleaseRepository(dbClient),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Release struct {
|
||||
gorm.Model
|
||||
ReleaseId uuid.UUID `gorm:"primaryKey"`
|
||||
ProjectReferenceId string
|
||||
ReleaseVersion string `gorm:"unique"`
|
||||
SourceMapUrl string // TODO: Check id required
|
||||
ProjectID string
|
||||
Project Project `gorm:"foreignKey:ProjectID"`
|
||||
}
|
||||
14
models/db/release.go
Normal file
14
models/db/release.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Release struct {
|
||||
gorm.Model
|
||||
ReleaseId uuid.UUID `gorm:"primaryKey"`
|
||||
ReleaseVersion string `gorm:"unique"`
|
||||
ProjectReferenceId string
|
||||
Project Project `gorm:"foreignKey:ProjectReferenceId;references:ProjectReferenceId;"`
|
||||
}
|
||||
Reference in New Issue
Block a user