mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
feat: adding background jobs, Dockerfile
This commit is contained in:
@@ -18,6 +18,6 @@ type APIKey struct {
|
||||
Revoked bool `gorm:"not null;default:false" json:"revoked"`
|
||||
Prefix *string `json:"prefix,omitempty"`
|
||||
LastUsedAt *time.Time `json:"last_used_at,omitempty" format:"date-time"`
|
||||
CreatedAt time.Time `gorm:"not null;default:now()" json:"created_at" format:"date-time"`
|
||||
UpdatedAt time.Time `gorm:"not null;default:now()" json:"updated_at" format:"date-time"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty" gorm:"type:timestamptz;column:created_at;not null;default:now()" format:"date-time"`
|
||||
UpdatedAt time.Time `json:"updated_at,omitempty" gorm:"type:timestamptz;autoUpdateTime;column:updated_at;not null;default:now()" format:"date-time"`
|
||||
}
|
||||
|
||||
23
internal/models/job.go
Normal file
23
internal/models/job.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
type Job struct {
|
||||
ID string `gorm:"type:varchar;primaryKey" json:"id"` // no default; supply from app
|
||||
QueueName string `gorm:"type:varchar;not null" json:"queue_name"`
|
||||
Status string `gorm:"type:varchar;not null" json:"status"`
|
||||
Arguments datatypes.JSON `gorm:"type:jsonb;not null;default:'{}'"`
|
||||
Result datatypes.JSON `gorm:"type:jsonb;not null;default:'{}'"`
|
||||
LastError *string `gorm:"type:varchar"`
|
||||
RetryCount int `gorm:"not null;default:0"`
|
||||
MaxRetry int `gorm:"not null;default:0"`
|
||||
RetryInterval int `gorm:"not null;default:0"`
|
||||
ScheduledAt time.Time `gorm:"type:timestamptz;default:now();index"`
|
||||
StartedAt *time.Time `gorm:"type:timestamptz;index"`
|
||||
CreatedAt time.Time `gorm:"type:timestamptz;column:created_at;not null;default:now()"`
|
||||
UpdatedAt time.Time `gorm:"type:timestamptz;autoUpdateTime;column:updated_at;not null;default:now()"`
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/glueops/autoglue/internal/common"
|
||||
)
|
||||
|
||||
type SshKey struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
||||
OrganizationID uuid.UUID `gorm:"type:uuid;not null" json:"organization_id"`
|
||||
common.AuditFields
|
||||
Organization Organization `gorm:"foreignKey:OrganizationID;constraint:OnDelete:CASCADE" json:"organization"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
PublicKey string `gorm:"not null"`
|
||||
@@ -16,6 +13,4 @@ type SshKey struct {
|
||||
PrivateIV string `gorm:"not null"`
|
||||
PrivateTag string `gorm:"not null"`
|
||||
Fingerprint string `gorm:"not null;index" json:"fingerprint"`
|
||||
CreatedAt time.Time `gorm:"not null;default:now()" json:"created_at" format:"date-time"`
|
||||
UpdatedAt time.Time `gorm:"not null;default:now()" json:"updated_at" format:"date-time"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user