feat(docker): Add Dockerfile and compose file

This commit is contained in:
Björn Benouarets
2025-11-29 03:09:40 +01:00
parent 08055398c4
commit 3c08a2cb25
13 changed files with 381 additions and 9 deletions

View File

@@ -0,0 +1,41 @@
package repositories
import (
"git.secnex.io/secnex/gogwapi/models"
"gorm.io/gorm"
)
type DomainRepository interface {
Create(domain *models.Domain) error
Get(id string) (*models.Domain, error)
Update(domain *models.Domain) error
Delete(id string) error
}
type domainRepository struct {
db *gorm.DB
}
func NewDomainRepository(db *gorm.DB) DomainRepository {
return &domainRepository{db: db}
}
func (r *domainRepository) Create(domain *models.Domain) error {
return r.db.Create(domain).Error
}
func (r *domainRepository) Get(name string) (*models.Domain, error) {
var domain models.Domain
if err := r.db.Where("name = ?", name).First(&domain).Error; err != nil {
return nil, err
}
return &domain, nil
}
func (r *domainRepository) Update(domain *models.Domain) error {
return r.db.Save(domain).Error
}
func (r *domainRepository) Delete(id string) error {
return r.db.Delete(&models.Domain{}, id).Error
}