first round of files
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type FederationActor struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
UserID int64 `xorm:"notnull unique index"`
|
||||
APID string `xorm:"notnull unique varchar(500)"` // https://instance/users/alice
|
||||
InboxURL string `xorm:"notnull varchar(500)"`
|
||||
OutboxURL string `xorm:"notnull varchar(500)"`
|
||||
PublicKey string `xorm:"text notnull"`
|
||||
PrivateKey string `xorm:"text notnull"` // AES-GCM encrypted at rest
|
||||
CreatedAt time.Time `xorm:"created"`
|
||||
UpdatedAt time.Time `xorm:"updated"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/forgao/forgebucket/internal/models"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func Run(engine *xorm.Engine) error {
|
||||
return engine.Sync2(
|
||||
&models.User{},
|
||||
&models.Repository{},
|
||||
&models.PullRequest{},
|
||||
&models.FederationActor{},
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type PRStatus string
|
||||
|
||||
const (
|
||||
PRStatusOpen PRStatus = "open"
|
||||
PRStatusMerged PRStatus = "merged"
|
||||
PRStatusClosed PRStatus = "closed"
|
||||
)
|
||||
|
||||
type PullRequest struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepoID int64 `xorm:"notnull index"`
|
||||
AuthorID int64 `xorm:"notnull index"`
|
||||
Title string `xorm:"notnull varchar(255)"`
|
||||
Body string `xorm:"text"`
|
||||
SourceBranch string `xorm:"notnull varchar(255)"`
|
||||
TargetBranch string `xorm:"default 'main' varchar(255)"`
|
||||
Status PRStatus `xorm:"default 'open' varchar(16)"`
|
||||
CreatedAt time.Time `xorm:"created"`
|
||||
UpdatedAt time.Time `xorm:"updated"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type Repository struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
OwnerID int64 `xorm:"notnull index"`
|
||||
Name string `xorm:"notnull varchar(100)"`
|
||||
Description string `xorm:"varchar(500)"`
|
||||
IsPrivate bool `xorm:"default false"`
|
||||
DefaultBranch string `xorm:"default 'main' varchar(255)"`
|
||||
DiskPath string `xorm:"notnull"` // absolute path under REPO_ROOT
|
||||
CreatedAt time.Time `xorm:"created"`
|
||||
UpdatedAt time.Time `xorm:"updated"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type User struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
Username string `xorm:"unique notnull varchar(64)"`
|
||||
Email string `xorm:"unique notnull varchar(255)"`
|
||||
PasswordHash string `xorm:"notnull"`
|
||||
AvatarURL string `xorm:"varchar(500)"`
|
||||
IsAdmin bool `xorm:"default false"`
|
||||
CreatedAt time.Time `xorm:"created"`
|
||||
UpdatedAt time.Time `xorm:"updated"`
|
||||
}
|
||||
Reference in New Issue
Block a user