35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
"time"
|
|
)
|
|
|
|
// CloudflareAccounts holds the schema definition for the CloudflareAccounts entity.
|
|
type CloudflareAccounts struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the CloudflareAccounts.
|
|
func (CloudflareAccounts) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("name").NotEmpty().Comment("账户名称"),
|
|
field.String("account_id").NotEmpty().Comment("Cloudflare Account ID"),
|
|
field.Text("api_token").Sensitive().Comment("Cloudflare API Token"),
|
|
field.String("email").Optional().Comment("Cloudflare 邮箱(可选)"),
|
|
field.Int8("status").Default(1).Comment("状态 1=启用, 0=禁用"),
|
|
field.Text("remark").Optional().Comment("备注"),
|
|
field.Time("created_at").Default(time.Now).Immutable(),
|
|
field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
|
|
}
|
|
}
|
|
|
|
// Edges of the CloudflareAccounts.
|
|
func (CloudflareAccounts) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.To("cloudflare_buckets", CloudflareR2.Type),
|
|
}
|
|
}
|