feat: add account notes field

This commit is contained in:
LLLLLLiulei
2026-01-05 14:07:33 +08:00
parent 7cc7e15174
commit 94750fb61f
25 changed files with 436 additions and 39 deletions

View File

@@ -27,6 +27,8 @@ type Account struct {
DeletedAt *time.Time `json:"deleted_at,omitempty"`
// Name holds the value of the "name" field.
Name string `json:"name,omitempty"`
// Notes holds the value of the "notes" field.
Notes *string `json:"notes,omitempty"`
// Platform holds the value of the "platform" field.
Platform string `json:"platform,omitempty"`
// Type holds the value of the "type" field.
@@ -131,7 +133,7 @@ func (*Account) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullBool)
case account.FieldID, account.FieldProxyID, account.FieldConcurrency, account.FieldPriority:
values[i] = new(sql.NullInt64)
case account.FieldName, account.FieldPlatform, account.FieldType, account.FieldStatus, account.FieldErrorMessage, account.FieldSessionWindowStatus:
case account.FieldName, account.FieldNotes, account.FieldPlatform, account.FieldType, account.FieldStatus, account.FieldErrorMessage, account.FieldSessionWindowStatus:
values[i] = new(sql.NullString)
case account.FieldCreatedAt, account.FieldUpdatedAt, account.FieldDeletedAt, account.FieldLastUsedAt, account.FieldRateLimitedAt, account.FieldRateLimitResetAt, account.FieldOverloadUntil, account.FieldSessionWindowStart, account.FieldSessionWindowEnd:
values[i] = new(sql.NullTime)
@@ -181,6 +183,13 @@ func (_m *Account) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.Name = value.String
}
case account.FieldNotes:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field notes", values[i])
} else if value.Valid {
_m.Notes = new(string)
*_m.Notes = value.String
}
case account.FieldPlatform:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field platform", values[i])
@@ -366,6 +375,11 @@ func (_m *Account) String() string {
builder.WriteString("name=")
builder.WriteString(_m.Name)
builder.WriteString(", ")
if v := _m.Notes; v != nil {
builder.WriteString("notes=")
builder.WriteString(*v)
}
builder.WriteString(", ")
builder.WriteString("platform=")
builder.WriteString(_m.Platform)
builder.WriteString(", ")

View File

@@ -23,6 +23,8 @@ const (
FieldDeletedAt = "deleted_at"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldNotes holds the string denoting the notes field in the database.
FieldNotes = "notes"
// FieldPlatform holds the string denoting the platform field in the database.
FieldPlatform = "platform"
// FieldType holds the string denoting the type field in the database.
@@ -102,6 +104,7 @@ var Columns = []string{
FieldUpdatedAt,
FieldDeletedAt,
FieldName,
FieldNotes,
FieldPlatform,
FieldType,
FieldCredentials,
@@ -203,6 +206,11 @@ func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByNotes orders the results by the notes field.
func ByNotes(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNotes, opts...).ToFunc()
}
// ByPlatform orders the results by the platform field.
func ByPlatform(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPlatform, opts...).ToFunc()

View File

@@ -75,6 +75,11 @@ func Name(v string) predicate.Account {
return predicate.Account(sql.FieldEQ(FieldName, v))
}
// Notes applies equality check predicate on the "notes" field. It's identical to NotesEQ.
func Notes(v string) predicate.Account {
return predicate.Account(sql.FieldEQ(FieldNotes, v))
}
// Platform applies equality check predicate on the "platform" field. It's identical to PlatformEQ.
func Platform(v string) predicate.Account {
return predicate.Account(sql.FieldEQ(FieldPlatform, v))
@@ -345,6 +350,81 @@ func NameContainsFold(v string) predicate.Account {
return predicate.Account(sql.FieldContainsFold(FieldName, v))
}
// NotesEQ applies the EQ predicate on the "notes" field.
func NotesEQ(v string) predicate.Account {
return predicate.Account(sql.FieldEQ(FieldNotes, v))
}
// NotesNEQ applies the NEQ predicate on the "notes" field.
func NotesNEQ(v string) predicate.Account {
return predicate.Account(sql.FieldNEQ(FieldNotes, v))
}
// NotesIn applies the In predicate on the "notes" field.
func NotesIn(vs ...string) predicate.Account {
return predicate.Account(sql.FieldIn(FieldNotes, vs...))
}
// NotesNotIn applies the NotIn predicate on the "notes" field.
func NotesNotIn(vs ...string) predicate.Account {
return predicate.Account(sql.FieldNotIn(FieldNotes, vs...))
}
// NotesGT applies the GT predicate on the "notes" field.
func NotesGT(v string) predicate.Account {
return predicate.Account(sql.FieldGT(FieldNotes, v))
}
// NotesGTE applies the GTE predicate on the "notes" field.
func NotesGTE(v string) predicate.Account {
return predicate.Account(sql.FieldGTE(FieldNotes, v))
}
// NotesLT applies the LT predicate on the "notes" field.
func NotesLT(v string) predicate.Account {
return predicate.Account(sql.FieldLT(FieldNotes, v))
}
// NotesLTE applies the LTE predicate on the "notes" field.
func NotesLTE(v string) predicate.Account {
return predicate.Account(sql.FieldLTE(FieldNotes, v))
}
// NotesContains applies the Contains predicate on the "notes" field.
func NotesContains(v string) predicate.Account {
return predicate.Account(sql.FieldContains(FieldNotes, v))
}
// NotesHasPrefix applies the HasPrefix predicate on the "notes" field.
func NotesHasPrefix(v string) predicate.Account {
return predicate.Account(sql.FieldHasPrefix(FieldNotes, v))
}
// NotesHasSuffix applies the HasSuffix predicate on the "notes" field.
func NotesHasSuffix(v string) predicate.Account {
return predicate.Account(sql.FieldHasSuffix(FieldNotes, v))
}
// NotesIsNil applies the IsNil predicate on the "notes" field.
func NotesIsNil() predicate.Account {
return predicate.Account(sql.FieldIsNull(FieldNotes))
}
// NotesNotNil applies the NotNil predicate on the "notes" field.
func NotesNotNil() predicate.Account {
return predicate.Account(sql.FieldNotNull(FieldNotes))
}
// NotesEqualFold applies the EqualFold predicate on the "notes" field.
func NotesEqualFold(v string) predicate.Account {
return predicate.Account(sql.FieldEqualFold(FieldNotes, v))
}
// NotesContainsFold applies the ContainsFold predicate on the "notes" field.
func NotesContainsFold(v string) predicate.Account {
return predicate.Account(sql.FieldContainsFold(FieldNotes, v))
}
// PlatformEQ applies the EQ predicate on the "platform" field.
func PlatformEQ(v string) predicate.Account {
return predicate.Account(sql.FieldEQ(FieldPlatform, v))

View File

@@ -73,6 +73,20 @@ func (_c *AccountCreate) SetName(v string) *AccountCreate {
return _c
}
// SetNotes sets the "notes" field.
func (_c *AccountCreate) SetNotes(v string) *AccountCreate {
_c.mutation.SetNotes(v)
return _c
}
// SetNillableNotes sets the "notes" field if the given value is not nil.
func (_c *AccountCreate) SetNillableNotes(v *string) *AccountCreate {
if v != nil {
_c.SetNotes(*v)
}
return _c
}
// SetPlatform sets the "platform" field.
func (_c *AccountCreate) SetPlatform(v string) *AccountCreate {
_c.mutation.SetPlatform(v)
@@ -501,6 +515,10 @@ func (_c *AccountCreate) createSpec() (*Account, *sqlgraph.CreateSpec) {
_spec.SetField(account.FieldName, field.TypeString, value)
_node.Name = value
}
if value, ok := _c.mutation.Notes(); ok {
_spec.SetField(account.FieldNotes, field.TypeString, value)
_node.Notes = &value
}
if value, ok := _c.mutation.Platform(); ok {
_spec.SetField(account.FieldPlatform, field.TypeString, value)
_node.Platform = value
@@ -712,6 +730,24 @@ func (u *AccountUpsert) UpdateName() *AccountUpsert {
return u
}
// SetNotes sets the "notes" field.
func (u *AccountUpsert) SetNotes(v string) *AccountUpsert {
u.Set(account.FieldNotes, v)
return u
}
// UpdateNotes sets the "notes" field to the value that was provided on create.
func (u *AccountUpsert) UpdateNotes() *AccountUpsert {
u.SetExcluded(account.FieldNotes)
return u
}
// ClearNotes clears the value of the "notes" field.
func (u *AccountUpsert) ClearNotes() *AccountUpsert {
u.SetNull(account.FieldNotes)
return u
}
// SetPlatform sets the "platform" field.
func (u *AccountUpsert) SetPlatform(v string) *AccountUpsert {
u.Set(account.FieldPlatform, v)
@@ -1076,6 +1112,27 @@ func (u *AccountUpsertOne) UpdateName() *AccountUpsertOne {
})
}
// SetNotes sets the "notes" field.
func (u *AccountUpsertOne) SetNotes(v string) *AccountUpsertOne {
return u.Update(func(s *AccountUpsert) {
s.SetNotes(v)
})
}
// UpdateNotes sets the "notes" field to the value that was provided on create.
func (u *AccountUpsertOne) UpdateNotes() *AccountUpsertOne {
return u.Update(func(s *AccountUpsert) {
s.UpdateNotes()
})
}
// ClearNotes clears the value of the "notes" field.
func (u *AccountUpsertOne) ClearNotes() *AccountUpsertOne {
return u.Update(func(s *AccountUpsert) {
s.ClearNotes()
})
}
// SetPlatform sets the "platform" field.
func (u *AccountUpsertOne) SetPlatform(v string) *AccountUpsertOne {
return u.Update(func(s *AccountUpsert) {
@@ -1651,6 +1708,27 @@ func (u *AccountUpsertBulk) UpdateName() *AccountUpsertBulk {
})
}
// SetNotes sets the "notes" field.
func (u *AccountUpsertBulk) SetNotes(v string) *AccountUpsertBulk {
return u.Update(func(s *AccountUpsert) {
s.SetNotes(v)
})
}
// UpdateNotes sets the "notes" field to the value that was provided on create.
func (u *AccountUpsertBulk) UpdateNotes() *AccountUpsertBulk {
return u.Update(func(s *AccountUpsert) {
s.UpdateNotes()
})
}
// ClearNotes clears the value of the "notes" field.
func (u *AccountUpsertBulk) ClearNotes() *AccountUpsertBulk {
return u.Update(func(s *AccountUpsert) {
s.ClearNotes()
})
}
// SetPlatform sets the "platform" field.
func (u *AccountUpsertBulk) SetPlatform(v string) *AccountUpsertBulk {
return u.Update(func(s *AccountUpsert) {

View File

@@ -71,6 +71,26 @@ func (_u *AccountUpdate) SetNillableName(v *string) *AccountUpdate {
return _u
}
// SetNotes sets the "notes" field.
func (_u *AccountUpdate) SetNotes(v string) *AccountUpdate {
_u.mutation.SetNotes(v)
return _u
}
// SetNillableNotes sets the "notes" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableNotes(v *string) *AccountUpdate {
if v != nil {
_u.SetNotes(*v)
}
return _u
}
// ClearNotes clears the value of the "notes" field.
func (_u *AccountUpdate) ClearNotes() *AccountUpdate {
_u.mutation.ClearNotes()
return _u
}
// SetPlatform sets the "platform" field.
func (_u *AccountUpdate) SetPlatform(v string) *AccountUpdate {
_u.mutation.SetPlatform(v)
@@ -545,6 +565,12 @@ func (_u *AccountUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if value, ok := _u.mutation.Name(); ok {
_spec.SetField(account.FieldName, field.TypeString, value)
}
if value, ok := _u.mutation.Notes(); ok {
_spec.SetField(account.FieldNotes, field.TypeString, value)
}
if _u.mutation.NotesCleared() {
_spec.ClearField(account.FieldNotes, field.TypeString)
}
if value, ok := _u.mutation.Platform(); ok {
_spec.SetField(account.FieldPlatform, field.TypeString, value)
}
@@ -814,6 +840,26 @@ func (_u *AccountUpdateOne) SetNillableName(v *string) *AccountUpdateOne {
return _u
}
// SetNotes sets the "notes" field.
func (_u *AccountUpdateOne) SetNotes(v string) *AccountUpdateOne {
_u.mutation.SetNotes(v)
return _u
}
// SetNillableNotes sets the "notes" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableNotes(v *string) *AccountUpdateOne {
if v != nil {
_u.SetNotes(*v)
}
return _u
}
// ClearNotes clears the value of the "notes" field.
func (_u *AccountUpdateOne) ClearNotes() *AccountUpdateOne {
_u.mutation.ClearNotes()
return _u
}
// SetPlatform sets the "platform" field.
func (_u *AccountUpdateOne) SetPlatform(v string) *AccountUpdateOne {
_u.mutation.SetPlatform(v)
@@ -1318,6 +1364,12 @@ func (_u *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err er
if value, ok := _u.mutation.Name(); ok {
_spec.SetField(account.FieldName, field.TypeString, value)
}
if value, ok := _u.mutation.Notes(); ok {
_spec.SetField(account.FieldNotes, field.TypeString, value)
}
if _u.mutation.NotesCleared() {
_spec.ClearField(account.FieldNotes, field.TypeString)
}
if value, ok := _u.mutation.Platform(); ok {
_spec.SetField(account.FieldPlatform, field.TypeString, value)
}

View File

@@ -70,6 +70,7 @@ var (
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
{Name: "name", Type: field.TypeString, Size: 100},
{Name: "notes", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
{Name: "platform", Type: field.TypeString, Size: 50},
{Name: "type", Type: field.TypeString, Size: 20},
{Name: "credentials", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
@@ -96,7 +97,7 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "accounts_proxies_proxy",
Columns: []*schema.Column{AccountsColumns[21]},
Columns: []*schema.Column{AccountsColumns[22]},
RefColumns: []*schema.Column{ProxiesColumns[0]},
OnDelete: schema.SetNull,
},
@@ -105,52 +106,52 @@ var (
{
Name: "account_platform",
Unique: false,
Columns: []*schema.Column{AccountsColumns[5]},
Columns: []*schema.Column{AccountsColumns[6]},
},
{
Name: "account_type",
Unique: false,
Columns: []*schema.Column{AccountsColumns[6]},
Columns: []*schema.Column{AccountsColumns[7]},
},
{
Name: "account_status",
Unique: false,
Columns: []*schema.Column{AccountsColumns[11]},
Columns: []*schema.Column{AccountsColumns[12]},
},
{
Name: "account_proxy_id",
Unique: false,
Columns: []*schema.Column{AccountsColumns[21]},
Columns: []*schema.Column{AccountsColumns[22]},
},
{
Name: "account_priority",
Unique: false,
Columns: []*schema.Column{AccountsColumns[10]},
Columns: []*schema.Column{AccountsColumns[11]},
},
{
Name: "account_last_used_at",
Unique: false,
Columns: []*schema.Column{AccountsColumns[13]},
Columns: []*schema.Column{AccountsColumns[14]},
},
{
Name: "account_schedulable",
Unique: false,
Columns: []*schema.Column{AccountsColumns[14]},
Columns: []*schema.Column{AccountsColumns[15]},
},
{
Name: "account_rate_limited_at",
Unique: false,
Columns: []*schema.Column{AccountsColumns[15]},
Columns: []*schema.Column{AccountsColumns[16]},
},
{
Name: "account_rate_limit_reset_at",
Unique: false,
Columns: []*schema.Column{AccountsColumns[16]},
Columns: []*schema.Column{AccountsColumns[17]},
},
{
Name: "account_overload_until",
Unique: false,
Columns: []*schema.Column{AccountsColumns[17]},
Columns: []*schema.Column{AccountsColumns[18]},
},
{
Name: "account_deleted_at",

View File

@@ -994,6 +994,7 @@ type AccountMutation struct {
updated_at *time.Time
deleted_at *time.Time
name *string
notes *string
platform *string
_type *string
credentials *map[string]interface{}
@@ -1281,6 +1282,55 @@ func (m *AccountMutation) ResetName() {
m.name = nil
}
// SetNotes sets the "notes" field.
func (m *AccountMutation) SetNotes(s string) {
m.notes = &s
}
// Notes returns the value of the "notes" field in the mutation.
func (m *AccountMutation) Notes() (r string, exists bool) {
v := m.notes
if v == nil {
return
}
return *v, true
}
// OldNotes returns the old "notes" field's value of the Account entity.
// If the Account object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *AccountMutation) OldNotes(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldNotes is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldNotes requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldNotes: %w", err)
}
return oldValue.Notes, nil
}
// ClearNotes clears the value of the "notes" field.
func (m *AccountMutation) ClearNotes() {
m.notes = nil
m.clearedFields[account.FieldNotes] = struct{}{}
}
// NotesCleared returns if the "notes" field was cleared in this mutation.
func (m *AccountMutation) NotesCleared() bool {
_, ok := m.clearedFields[account.FieldNotes]
return ok
}
// ResetNotes resets all changes to the "notes" field.
func (m *AccountMutation) ResetNotes() {
m.notes = nil
delete(m.clearedFields, account.FieldNotes)
}
// SetPlatform sets the "platform" field.
func (m *AccountMutation) SetPlatform(s string) {
m.platform = &s
@@ -2219,7 +2269,7 @@ func (m *AccountMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *AccountMutation) Fields() []string {
fields := make([]string, 0, 21)
fields := make([]string, 0, 22)
if m.created_at != nil {
fields = append(fields, account.FieldCreatedAt)
}
@@ -2232,6 +2282,9 @@ func (m *AccountMutation) Fields() []string {
if m.name != nil {
fields = append(fields, account.FieldName)
}
if m.notes != nil {
fields = append(fields, account.FieldNotes)
}
if m.platform != nil {
fields = append(fields, account.FieldPlatform)
}
@@ -2299,6 +2352,8 @@ func (m *AccountMutation) Field(name string) (ent.Value, bool) {
return m.DeletedAt()
case account.FieldName:
return m.Name()
case account.FieldNotes:
return m.Notes()
case account.FieldPlatform:
return m.Platform()
case account.FieldType:
@@ -2350,6 +2405,8 @@ func (m *AccountMutation) OldField(ctx context.Context, name string) (ent.Value,
return m.OldDeletedAt(ctx)
case account.FieldName:
return m.OldName(ctx)
case account.FieldNotes:
return m.OldNotes(ctx)
case account.FieldPlatform:
return m.OldPlatform(ctx)
case account.FieldType:
@@ -2421,6 +2478,13 @@ func (m *AccountMutation) SetField(name string, value ent.Value) error {
}
m.SetName(v)
return nil
case account.FieldNotes:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetNotes(v)
return nil
case account.FieldPlatform:
v, ok := value.(string)
if !ok {
@@ -2600,6 +2664,9 @@ func (m *AccountMutation) ClearedFields() []string {
if m.FieldCleared(account.FieldDeletedAt) {
fields = append(fields, account.FieldDeletedAt)
}
if m.FieldCleared(account.FieldNotes) {
fields = append(fields, account.FieldNotes)
}
if m.FieldCleared(account.FieldProxyID) {
fields = append(fields, account.FieldProxyID)
}
@@ -2644,6 +2711,9 @@ func (m *AccountMutation) ClearField(name string) error {
case account.FieldDeletedAt:
m.ClearDeletedAt()
return nil
case account.FieldNotes:
m.ClearNotes()
return nil
case account.FieldProxyID:
m.ClearProxyID()
return nil
@@ -2691,6 +2761,9 @@ func (m *AccountMutation) ResetField(name string) error {
case account.FieldName:
m.ResetName()
return nil
case account.FieldNotes:
m.ResetNotes()
return nil
case account.FieldPlatform:
m.ResetPlatform()
return nil

View File

@@ -124,7 +124,7 @@ func init() {
}
}()
// accountDescPlatform is the schema descriptor for platform field.
accountDescPlatform := accountFields[1].Descriptor()
accountDescPlatform := accountFields[2].Descriptor()
// account.PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
account.PlatformValidator = func() func(string) error {
validators := accountDescPlatform.Validators
@@ -142,7 +142,7 @@ func init() {
}
}()
// accountDescType is the schema descriptor for type field.
accountDescType := accountFields[2].Descriptor()
accountDescType := accountFields[3].Descriptor()
// account.TypeValidator is a validator for the "type" field. It is called by the builders before save.
account.TypeValidator = func() func(string) error {
validators := accountDescType.Validators
@@ -160,33 +160,33 @@ func init() {
}
}()
// accountDescCredentials is the schema descriptor for credentials field.
accountDescCredentials := accountFields[3].Descriptor()
accountDescCredentials := accountFields[4].Descriptor()
// account.DefaultCredentials holds the default value on creation for the credentials field.
account.DefaultCredentials = accountDescCredentials.Default.(func() map[string]interface{})
// accountDescExtra is the schema descriptor for extra field.
accountDescExtra := accountFields[4].Descriptor()
accountDescExtra := accountFields[5].Descriptor()
// account.DefaultExtra holds the default value on creation for the extra field.
account.DefaultExtra = accountDescExtra.Default.(func() map[string]interface{})
// accountDescConcurrency is the schema descriptor for concurrency field.
accountDescConcurrency := accountFields[6].Descriptor()
accountDescConcurrency := accountFields[7].Descriptor()
// account.DefaultConcurrency holds the default value on creation for the concurrency field.
account.DefaultConcurrency = accountDescConcurrency.Default.(int)
// accountDescPriority is the schema descriptor for priority field.
accountDescPriority := accountFields[7].Descriptor()
accountDescPriority := accountFields[8].Descriptor()
// account.DefaultPriority holds the default value on creation for the priority field.
account.DefaultPriority = accountDescPriority.Default.(int)
// accountDescStatus is the schema descriptor for status field.
accountDescStatus := accountFields[8].Descriptor()
accountDescStatus := accountFields[9].Descriptor()
// account.DefaultStatus holds the default value on creation for the status field.
account.DefaultStatus = accountDescStatus.Default.(string)
// account.StatusValidator is a validator for the "status" field. It is called by the builders before save.
account.StatusValidator = accountDescStatus.Validators[0].(func(string) error)
// accountDescSchedulable is the schema descriptor for schedulable field.
accountDescSchedulable := accountFields[11].Descriptor()
accountDescSchedulable := accountFields[12].Descriptor()
// account.DefaultSchedulable holds the default value on creation for the schedulable field.
account.DefaultSchedulable = accountDescSchedulable.Default.(bool)
// accountDescSessionWindowStatus is the schema descriptor for session_window_status field.
accountDescSessionWindowStatus := accountFields[17].Descriptor()
accountDescSessionWindowStatus := accountFields[18].Descriptor()
// account.SessionWindowStatusValidator is a validator for the "session_window_status" field. It is called by the builders before save.
account.SessionWindowStatusValidator = accountDescSessionWindowStatus.Validators[0].(func(string) error)
accountgroupFields := schema.AccountGroup{}.Fields()

View File

@@ -54,6 +54,11 @@ func (Account) Fields() []ent.Field {
field.String("name").
MaxLen(100).
NotEmpty(),
// notes: 管理员备注(可为空)
field.String("notes").
Optional().
Nillable().
SchemaType(map[string]string{dialect.Postgres: "text"}),
// platform: 所属平台,如 "claude", "gemini", "openai" 等
field.String("platform").