Compare commits
2 Commits
dc01c83e9d
...
main
Author | SHA1 | Date | |
---|---|---|---|
0add1e1c10
|
|||
22734a4b4c
|
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,9 +1,2 @@
|
|||||||
t
|
t
|
||||||
.env
|
|
||||||
*.json
|
|
||||||
*.sqlite
|
*.sqlite
|
||||||
#*.zsh
|
|
||||||
tmp/card_limit.zsh
|
|
||||||
tmp/card_day.zsh
|
|
||||||
tmp/card_delete.zsh
|
|
||||||
memo.md
|
|
||||||
|
11
build.zsh
11
build.zsh
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
d=${0:a:h}
|
|
||||||
cd $d
|
|
||||||
su=4000
|
|
||||||
|
|
||||||
go generate ./...
|
|
||||||
sed -i '' "s/255/$su/g" $d/ent/ogent/oas_parameters_gen.go
|
|
||||||
sed -i '' "s/255/$su/g" $d/ent/openapi.json
|
|
||||||
|
|
||||||
cp -rf $d/tmp/ogent ent/
|
|
33
ent/card.go
33
ent/card.go
@@ -17,16 +17,10 @@ type Card struct {
|
|||||||
config `json:"-"`
|
config `json:"-"`
|
||||||
// ID of the ent.
|
// ID of the ent.
|
||||||
ID int `json:"id,omitempty"`
|
ID int `json:"id,omitempty"`
|
||||||
// Password holds the value of the "password" field.
|
|
||||||
Password string `json:"-"`
|
|
||||||
// Card holds the value of the "card" field.
|
// Card holds the value of the "card" field.
|
||||||
Card int `json:"card,omitempty"`
|
Card int `json:"card,omitempty"`
|
||||||
// Skill holds the value of the "skill" field.
|
|
||||||
Skill string `json:"skill,omitempty"`
|
|
||||||
// Status holds the value of the "status" field.
|
// Status holds the value of the "status" field.
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
// Token holds the value of the "token" field.
|
|
||||||
Token string `json:"-"`
|
|
||||||
// Cp holds the value of the "cp" field.
|
// Cp holds the value of the "cp" field.
|
||||||
Cp int `json:"cp,omitempty"`
|
Cp int `json:"cp,omitempty"`
|
||||||
// URL holds the value of the "url" field.
|
// URL holds the value of the "url" field.
|
||||||
@@ -68,7 +62,7 @@ func (*Card) scanValues(columns []string) ([]any, error) {
|
|||||||
switch columns[i] {
|
switch columns[i] {
|
||||||
case card.FieldID, card.FieldCard, card.FieldCp:
|
case card.FieldID, card.FieldCard, card.FieldCp:
|
||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case card.FieldPassword, card.FieldSkill, card.FieldStatus, card.FieldToken, card.FieldURL:
|
case card.FieldStatus, card.FieldURL:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
case card.FieldCreatedAt:
|
case card.FieldCreatedAt:
|
||||||
values[i] = new(sql.NullTime)
|
values[i] = new(sql.NullTime)
|
||||||
@@ -95,36 +89,18 @@ func (c *Card) assignValues(columns []string, values []any) error {
|
|||||||
return fmt.Errorf("unexpected type %T for field id", value)
|
return fmt.Errorf("unexpected type %T for field id", value)
|
||||||
}
|
}
|
||||||
c.ID = int(value.Int64)
|
c.ID = int(value.Int64)
|
||||||
case card.FieldPassword:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field password", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
c.Password = value.String
|
|
||||||
}
|
|
||||||
case card.FieldCard:
|
case card.FieldCard:
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field card", values[i])
|
return fmt.Errorf("unexpected type %T for field card", values[i])
|
||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
c.Card = int(value.Int64)
|
c.Card = int(value.Int64)
|
||||||
}
|
}
|
||||||
case card.FieldSkill:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field skill", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
c.Skill = value.String
|
|
||||||
}
|
|
||||||
case card.FieldStatus:
|
case card.FieldStatus:
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field status", values[i])
|
return fmt.Errorf("unexpected type %T for field status", values[i])
|
||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
c.Status = value.String
|
c.Status = value.String
|
||||||
}
|
}
|
||||||
case card.FieldToken:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field token", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
c.Token = value.String
|
|
||||||
}
|
|
||||||
case card.FieldCp:
|
case card.FieldCp:
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field cp", values[i])
|
return fmt.Errorf("unexpected type %T for field cp", values[i])
|
||||||
@@ -183,19 +159,12 @@ func (c *Card) String() string {
|
|||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
builder.WriteString("Card(")
|
builder.WriteString("Card(")
|
||||||
builder.WriteString(fmt.Sprintf("id=%v, ", c.ID))
|
builder.WriteString(fmt.Sprintf("id=%v, ", c.ID))
|
||||||
builder.WriteString("password=<sensitive>")
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("card=")
|
builder.WriteString("card=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", c.Card))
|
builder.WriteString(fmt.Sprintf("%v", c.Card))
|
||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("skill=")
|
|
||||||
builder.WriteString(c.Skill)
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("status=")
|
builder.WriteString("status=")
|
||||||
builder.WriteString(c.Status)
|
builder.WriteString(c.Status)
|
||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("token=<sensitive>")
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("cp=")
|
builder.WriteString("cp=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", c.Cp))
|
builder.WriteString(fmt.Sprintf("%v", c.Cp))
|
||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
|
@@ -11,16 +11,10 @@ const (
|
|||||||
Label = "card"
|
Label = "card"
|
||||||
// FieldID holds the string denoting the id field in the database.
|
// FieldID holds the string denoting the id field in the database.
|
||||||
FieldID = "id"
|
FieldID = "id"
|
||||||
// FieldPassword holds the string denoting the password field in the database.
|
|
||||||
FieldPassword = "password"
|
|
||||||
// FieldCard holds the string denoting the card field in the database.
|
// FieldCard holds the string denoting the card field in the database.
|
||||||
FieldCard = "card"
|
FieldCard = "card"
|
||||||
// FieldSkill holds the string denoting the skill field in the database.
|
|
||||||
FieldSkill = "skill"
|
|
||||||
// FieldStatus holds the string denoting the status field in the database.
|
// FieldStatus holds the string denoting the status field in the database.
|
||||||
FieldStatus = "status"
|
FieldStatus = "status"
|
||||||
// FieldToken holds the string denoting the token field in the database.
|
|
||||||
FieldToken = "token"
|
|
||||||
// FieldCp holds the string denoting the cp field in the database.
|
// FieldCp holds the string denoting the cp field in the database.
|
||||||
FieldCp = "cp"
|
FieldCp = "cp"
|
||||||
// FieldURL holds the string denoting the url field in the database.
|
// FieldURL holds the string denoting the url field in the database.
|
||||||
@@ -43,11 +37,8 @@ const (
|
|||||||
// Columns holds all SQL columns for card fields.
|
// Columns holds all SQL columns for card fields.
|
||||||
var Columns = []string{
|
var Columns = []string{
|
||||||
FieldID,
|
FieldID,
|
||||||
FieldPassword,
|
|
||||||
FieldCard,
|
FieldCard,
|
||||||
FieldSkill,
|
|
||||||
FieldStatus,
|
FieldStatus,
|
||||||
FieldToken,
|
|
||||||
FieldCp,
|
FieldCp,
|
||||||
FieldURL,
|
FieldURL,
|
||||||
FieldCreatedAt,
|
FieldCreatedAt,
|
||||||
@@ -75,12 +66,8 @@ func ValidColumn(column string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
||||||
PasswordValidator func(string) error
|
|
||||||
// DefaultCard holds the default value on creation for the "card" field.
|
// DefaultCard holds the default value on creation for the "card" field.
|
||||||
DefaultCard func() int
|
DefaultCard func() int
|
||||||
// DefaultSkill holds the default value on creation for the "skill" field.
|
|
||||||
DefaultSkill func() string
|
|
||||||
// DefaultStatus holds the default value on creation for the "status" field.
|
// DefaultStatus holds the default value on creation for the "status" field.
|
||||||
DefaultStatus func() string
|
DefaultStatus func() string
|
||||||
// DefaultCp holds the default value on creation for the "cp" field.
|
// DefaultCp holds the default value on creation for the "cp" field.
|
||||||
|
@@ -55,31 +55,16 @@ func IDLTE(id int) predicate.Card {
|
|||||||
return predicate.Card(sql.FieldLTE(FieldID, id))
|
return predicate.Card(sql.FieldLTE(FieldID, id))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Password applies equality check predicate on the "password" field. It's identical to PasswordEQ.
|
|
||||||
func Password(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEQ(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Card applies equality check predicate on the "card" field. It's identical to CardEQ.
|
// Card applies equality check predicate on the "card" field. It's identical to CardEQ.
|
||||||
func Card(v int) predicate.Card {
|
func Card(v int) predicate.Card {
|
||||||
return predicate.Card(sql.FieldEQ(FieldCard, v))
|
return predicate.Card(sql.FieldEQ(FieldCard, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skill applies equality check predicate on the "skill" field. It's identical to SkillEQ.
|
|
||||||
func Skill(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEQ(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
||||||
func Status(v string) predicate.Card {
|
func Status(v string) predicate.Card {
|
||||||
return predicate.Card(sql.FieldEQ(FieldStatus, v))
|
return predicate.Card(sql.FieldEQ(FieldStatus, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Token applies equality check predicate on the "token" field. It's identical to TokenEQ.
|
|
||||||
func Token(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEQ(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cp applies equality check predicate on the "cp" field. It's identical to CpEQ.
|
// Cp applies equality check predicate on the "cp" field. It's identical to CpEQ.
|
||||||
func Cp(v int) predicate.Card {
|
func Cp(v int) predicate.Card {
|
||||||
return predicate.Card(sql.FieldEQ(FieldCp, v))
|
return predicate.Card(sql.FieldEQ(FieldCp, v))
|
||||||
@@ -95,71 +80,6 @@ func CreatedAt(v time.Time) predicate.Card {
|
|||||||
return predicate.Card(sql.FieldEQ(FieldCreatedAt, v))
|
return predicate.Card(sql.FieldEQ(FieldCreatedAt, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PasswordEQ applies the EQ predicate on the "password" field.
|
|
||||||
func PasswordEQ(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEQ(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordNEQ applies the NEQ predicate on the "password" field.
|
|
||||||
func PasswordNEQ(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNEQ(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordIn applies the In predicate on the "password" field.
|
|
||||||
func PasswordIn(vs ...string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldIn(FieldPassword, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordNotIn applies the NotIn predicate on the "password" field.
|
|
||||||
func PasswordNotIn(vs ...string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNotIn(FieldPassword, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordGT applies the GT predicate on the "password" field.
|
|
||||||
func PasswordGT(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldGT(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordGTE applies the GTE predicate on the "password" field.
|
|
||||||
func PasswordGTE(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldGTE(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordLT applies the LT predicate on the "password" field.
|
|
||||||
func PasswordLT(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldLT(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordLTE applies the LTE predicate on the "password" field.
|
|
||||||
func PasswordLTE(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldLTE(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordContains applies the Contains predicate on the "password" field.
|
|
||||||
func PasswordContains(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldContains(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordHasPrefix applies the HasPrefix predicate on the "password" field.
|
|
||||||
func PasswordHasPrefix(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldHasPrefix(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordHasSuffix applies the HasSuffix predicate on the "password" field.
|
|
||||||
func PasswordHasSuffix(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldHasSuffix(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordEqualFold applies the EqualFold predicate on the "password" field.
|
|
||||||
func PasswordEqualFold(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEqualFold(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordContainsFold applies the ContainsFold predicate on the "password" field.
|
|
||||||
func PasswordContainsFold(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldContainsFold(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CardEQ applies the EQ predicate on the "card" field.
|
// CardEQ applies the EQ predicate on the "card" field.
|
||||||
func CardEQ(v int) predicate.Card {
|
func CardEQ(v int) predicate.Card {
|
||||||
return predicate.Card(sql.FieldEQ(FieldCard, v))
|
return predicate.Card(sql.FieldEQ(FieldCard, v))
|
||||||
@@ -210,81 +130,6 @@ func CardNotNil() predicate.Card {
|
|||||||
return predicate.Card(sql.FieldNotNull(FieldCard))
|
return predicate.Card(sql.FieldNotNull(FieldCard))
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkillEQ applies the EQ predicate on the "skill" field.
|
|
||||||
func SkillEQ(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEQ(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillNEQ applies the NEQ predicate on the "skill" field.
|
|
||||||
func SkillNEQ(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNEQ(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillIn applies the In predicate on the "skill" field.
|
|
||||||
func SkillIn(vs ...string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldIn(FieldSkill, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillNotIn applies the NotIn predicate on the "skill" field.
|
|
||||||
func SkillNotIn(vs ...string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNotIn(FieldSkill, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillGT applies the GT predicate on the "skill" field.
|
|
||||||
func SkillGT(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldGT(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillGTE applies the GTE predicate on the "skill" field.
|
|
||||||
func SkillGTE(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldGTE(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillLT applies the LT predicate on the "skill" field.
|
|
||||||
func SkillLT(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldLT(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillLTE applies the LTE predicate on the "skill" field.
|
|
||||||
func SkillLTE(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldLTE(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillContains applies the Contains predicate on the "skill" field.
|
|
||||||
func SkillContains(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldContains(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillHasPrefix applies the HasPrefix predicate on the "skill" field.
|
|
||||||
func SkillHasPrefix(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldHasPrefix(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillHasSuffix applies the HasSuffix predicate on the "skill" field.
|
|
||||||
func SkillHasSuffix(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldHasSuffix(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillIsNil applies the IsNil predicate on the "skill" field.
|
|
||||||
func SkillIsNil() predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldIsNull(FieldSkill))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillNotNil applies the NotNil predicate on the "skill" field.
|
|
||||||
func SkillNotNil() predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNotNull(FieldSkill))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillEqualFold applies the EqualFold predicate on the "skill" field.
|
|
||||||
func SkillEqualFold(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEqualFold(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// SkillContainsFold applies the ContainsFold predicate on the "skill" field.
|
|
||||||
func SkillContainsFold(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldContainsFold(FieldSkill, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// StatusEQ applies the EQ predicate on the "status" field.
|
// StatusEQ applies the EQ predicate on the "status" field.
|
||||||
func StatusEQ(v string) predicate.Card {
|
func StatusEQ(v string) predicate.Card {
|
||||||
return predicate.Card(sql.FieldEQ(FieldStatus, v))
|
return predicate.Card(sql.FieldEQ(FieldStatus, v))
|
||||||
@@ -360,81 +205,6 @@ func StatusContainsFold(v string) predicate.Card {
|
|||||||
return predicate.Card(sql.FieldContainsFold(FieldStatus, v))
|
return predicate.Card(sql.FieldContainsFold(FieldStatus, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TokenEQ applies the EQ predicate on the "token" field.
|
|
||||||
func TokenEQ(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEQ(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenNEQ applies the NEQ predicate on the "token" field.
|
|
||||||
func TokenNEQ(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNEQ(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenIn applies the In predicate on the "token" field.
|
|
||||||
func TokenIn(vs ...string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldIn(FieldToken, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenNotIn applies the NotIn predicate on the "token" field.
|
|
||||||
func TokenNotIn(vs ...string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNotIn(FieldToken, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenGT applies the GT predicate on the "token" field.
|
|
||||||
func TokenGT(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldGT(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenGTE applies the GTE predicate on the "token" field.
|
|
||||||
func TokenGTE(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldGTE(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenLT applies the LT predicate on the "token" field.
|
|
||||||
func TokenLT(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldLT(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenLTE applies the LTE predicate on the "token" field.
|
|
||||||
func TokenLTE(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldLTE(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenContains applies the Contains predicate on the "token" field.
|
|
||||||
func TokenContains(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldContains(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenHasPrefix applies the HasPrefix predicate on the "token" field.
|
|
||||||
func TokenHasPrefix(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldHasPrefix(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenHasSuffix applies the HasSuffix predicate on the "token" field.
|
|
||||||
func TokenHasSuffix(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldHasSuffix(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenIsNil applies the IsNil predicate on the "token" field.
|
|
||||||
func TokenIsNil() predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldIsNull(FieldToken))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenNotNil applies the NotNil predicate on the "token" field.
|
|
||||||
func TokenNotNil() predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldNotNull(FieldToken))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenEqualFold applies the EqualFold predicate on the "token" field.
|
|
||||||
func TokenEqualFold(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldEqualFold(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// TokenContainsFold applies the ContainsFold predicate on the "token" field.
|
|
||||||
func TokenContainsFold(v string) predicate.Card {
|
|
||||||
return predicate.Card(sql.FieldContainsFold(FieldToken, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// CpEQ applies the EQ predicate on the "cp" field.
|
// CpEQ applies the EQ predicate on the "cp" field.
|
||||||
func CpEQ(v int) predicate.Card {
|
func CpEQ(v int) predicate.Card {
|
||||||
return predicate.Card(sql.FieldEQ(FieldCp, v))
|
return predicate.Card(sql.FieldEQ(FieldCp, v))
|
||||||
|
@@ -21,12 +21,6 @@ type CardCreate struct {
|
|||||||
hooks []Hook
|
hooks []Hook
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPassword sets the "password" field.
|
|
||||||
func (cc *CardCreate) SetPassword(s string) *CardCreate {
|
|
||||||
cc.mutation.SetPassword(s)
|
|
||||||
return cc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCard sets the "card" field.
|
// SetCard sets the "card" field.
|
||||||
func (cc *CardCreate) SetCard(i int) *CardCreate {
|
func (cc *CardCreate) SetCard(i int) *CardCreate {
|
||||||
cc.mutation.SetCard(i)
|
cc.mutation.SetCard(i)
|
||||||
@@ -41,20 +35,6 @@ func (cc *CardCreate) SetNillableCard(i *int) *CardCreate {
|
|||||||
return cc
|
return cc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSkill sets the "skill" field.
|
|
||||||
func (cc *CardCreate) SetSkill(s string) *CardCreate {
|
|
||||||
cc.mutation.SetSkill(s)
|
|
||||||
return cc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableSkill sets the "skill" field if the given value is not nil.
|
|
||||||
func (cc *CardCreate) SetNillableSkill(s *string) *CardCreate {
|
|
||||||
if s != nil {
|
|
||||||
cc.SetSkill(*s)
|
|
||||||
}
|
|
||||||
return cc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetStatus sets the "status" field.
|
// SetStatus sets the "status" field.
|
||||||
func (cc *CardCreate) SetStatus(s string) *CardCreate {
|
func (cc *CardCreate) SetStatus(s string) *CardCreate {
|
||||||
cc.mutation.SetStatus(s)
|
cc.mutation.SetStatus(s)
|
||||||
@@ -69,20 +49,6 @@ func (cc *CardCreate) SetNillableStatus(s *string) *CardCreate {
|
|||||||
return cc
|
return cc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetToken sets the "token" field.
|
|
||||||
func (cc *CardCreate) SetToken(s string) *CardCreate {
|
|
||||||
cc.mutation.SetToken(s)
|
|
||||||
return cc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableToken sets the "token" field if the given value is not nil.
|
|
||||||
func (cc *CardCreate) SetNillableToken(s *string) *CardCreate {
|
|
||||||
if s != nil {
|
|
||||||
cc.SetToken(*s)
|
|
||||||
}
|
|
||||||
return cc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCp sets the "cp" field.
|
// SetCp sets the "cp" field.
|
||||||
func (cc *CardCreate) SetCp(i int) *CardCreate {
|
func (cc *CardCreate) SetCp(i int) *CardCreate {
|
||||||
cc.mutation.SetCp(i)
|
cc.mutation.SetCp(i)
|
||||||
@@ -175,10 +141,6 @@ func (cc *CardCreate) defaults() {
|
|||||||
v := card.DefaultCard()
|
v := card.DefaultCard()
|
||||||
cc.mutation.SetCard(v)
|
cc.mutation.SetCard(v)
|
||||||
}
|
}
|
||||||
if _, ok := cc.mutation.Skill(); !ok {
|
|
||||||
v := card.DefaultSkill()
|
|
||||||
cc.mutation.SetSkill(v)
|
|
||||||
}
|
|
||||||
if _, ok := cc.mutation.Status(); !ok {
|
if _, ok := cc.mutation.Status(); !ok {
|
||||||
v := card.DefaultStatus()
|
v := card.DefaultStatus()
|
||||||
cc.mutation.SetStatus(v)
|
cc.mutation.SetStatus(v)
|
||||||
@@ -199,14 +161,6 @@ func (cc *CardCreate) defaults() {
|
|||||||
|
|
||||||
// check runs all checks and user-defined validators on the builder.
|
// check runs all checks and user-defined validators on the builder.
|
||||||
func (cc *CardCreate) check() error {
|
func (cc *CardCreate) check() error {
|
||||||
if _, ok := cc.mutation.Password(); !ok {
|
|
||||||
return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "Card.password"`)}
|
|
||||||
}
|
|
||||||
if v, ok := cc.mutation.Password(); ok {
|
|
||||||
if err := card.PasswordValidator(v); err != nil {
|
|
||||||
return &ValidationError{Name: "password", err: fmt.Errorf(`ent: validator failed for field "Card.password": %w`, err)}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if _, ok := cc.mutation.OwnerID(); !ok {
|
if _, ok := cc.mutation.OwnerID(); !ok {
|
||||||
return &ValidationError{Name: "owner", err: errors.New(`ent: missing required edge "Card.owner"`)}
|
return &ValidationError{Name: "owner", err: errors.New(`ent: missing required edge "Card.owner"`)}
|
||||||
}
|
}
|
||||||
@@ -236,26 +190,14 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) {
|
|||||||
_node = &Card{config: cc.config}
|
_node = &Card{config: cc.config}
|
||||||
_spec = sqlgraph.NewCreateSpec(card.Table, sqlgraph.NewFieldSpec(card.FieldID, field.TypeInt))
|
_spec = sqlgraph.NewCreateSpec(card.Table, sqlgraph.NewFieldSpec(card.FieldID, field.TypeInt))
|
||||||
)
|
)
|
||||||
if value, ok := cc.mutation.Password(); ok {
|
|
||||||
_spec.SetField(card.FieldPassword, field.TypeString, value)
|
|
||||||
_node.Password = value
|
|
||||||
}
|
|
||||||
if value, ok := cc.mutation.Card(); ok {
|
if value, ok := cc.mutation.Card(); ok {
|
||||||
_spec.SetField(card.FieldCard, field.TypeInt, value)
|
_spec.SetField(card.FieldCard, field.TypeInt, value)
|
||||||
_node.Card = value
|
_node.Card = value
|
||||||
}
|
}
|
||||||
if value, ok := cc.mutation.Skill(); ok {
|
|
||||||
_spec.SetField(card.FieldSkill, field.TypeString, value)
|
|
||||||
_node.Skill = value
|
|
||||||
}
|
|
||||||
if value, ok := cc.mutation.Status(); ok {
|
if value, ok := cc.mutation.Status(); ok {
|
||||||
_spec.SetField(card.FieldStatus, field.TypeString, value)
|
_spec.SetField(card.FieldStatus, field.TypeString, value)
|
||||||
_node.Status = value
|
_node.Status = value
|
||||||
}
|
}
|
||||||
if value, ok := cc.mutation.Token(); ok {
|
|
||||||
_spec.SetField(card.FieldToken, field.TypeString, value)
|
|
||||||
_node.Token = value
|
|
||||||
}
|
|
||||||
if value, ok := cc.mutation.Cp(); ok {
|
if value, ok := cc.mutation.Cp(); ok {
|
||||||
_spec.SetField(card.FieldCp, field.TypeInt, value)
|
_spec.SetField(card.FieldCp, field.TypeInt, value)
|
||||||
_node.Cp = value
|
_node.Cp = value
|
||||||
@@ -276,7 +218,10 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) {
|
|||||||
Columns: []string{card.OwnerColumn},
|
Columns: []string{card.OwnerColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
|
@@ -298,12 +298,12 @@ func (cq *CardQuery) WithOwner(opts ...func(*UserQuery)) *CardQuery {
|
|||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// var v []struct {
|
// var v []struct {
|
||||||
// Password string `json:"password,omitempty"`
|
// Card int `json:"card,omitempty"`
|
||||||
// Count int `json:"count,omitempty"`
|
// Count int `json:"count,omitempty"`
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// client.Card.Query().
|
// client.Card.Query().
|
||||||
// GroupBy(card.FieldPassword).
|
// GroupBy(card.FieldCard).
|
||||||
// Aggregate(ent.Count()).
|
// Aggregate(ent.Count()).
|
||||||
// Scan(ctx, &v)
|
// Scan(ctx, &v)
|
||||||
func (cq *CardQuery) GroupBy(field string, fields ...string) *CardGroupBy {
|
func (cq *CardQuery) GroupBy(field string, fields ...string) *CardGroupBy {
|
||||||
@@ -321,11 +321,11 @@ func (cq *CardQuery) GroupBy(field string, fields ...string) *CardGroupBy {
|
|||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// var v []struct {
|
// var v []struct {
|
||||||
// Password string `json:"password,omitempty"`
|
// Card int `json:"card,omitempty"`
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// client.Card.Query().
|
// client.Card.Query().
|
||||||
// Select(card.FieldPassword).
|
// Select(card.FieldCard).
|
||||||
// Scan(ctx, &v)
|
// Scan(ctx, &v)
|
||||||
func (cq *CardQuery) Select(fields ...string) *CardSelect {
|
func (cq *CardQuery) Select(fields ...string) *CardSelect {
|
||||||
cq.ctx.Fields = append(cq.ctx.Fields, fields...)
|
cq.ctx.Fields = append(cq.ctx.Fields, fields...)
|
||||||
|
@@ -28,93 +28,6 @@ func (cu *CardUpdate) Where(ps ...predicate.Card) *CardUpdate {
|
|||||||
return cu
|
return cu
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSkill sets the "skill" field.
|
|
||||||
func (cu *CardUpdate) SetSkill(s string) *CardUpdate {
|
|
||||||
cu.mutation.SetSkill(s)
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableSkill sets the "skill" field if the given value is not nil.
|
|
||||||
func (cu *CardUpdate) SetNillableSkill(s *string) *CardUpdate {
|
|
||||||
if s != nil {
|
|
||||||
cu.SetSkill(*s)
|
|
||||||
}
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearSkill clears the value of the "skill" field.
|
|
||||||
func (cu *CardUpdate) ClearSkill() *CardUpdate {
|
|
||||||
cu.mutation.ClearSkill()
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetStatus sets the "status" field.
|
|
||||||
func (cu *CardUpdate) SetStatus(s string) *CardUpdate {
|
|
||||||
cu.mutation.SetStatus(s)
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
||||||
func (cu *CardUpdate) SetNillableStatus(s *string) *CardUpdate {
|
|
||||||
if s != nil {
|
|
||||||
cu.SetStatus(*s)
|
|
||||||
}
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearStatus clears the value of the "status" field.
|
|
||||||
func (cu *CardUpdate) ClearStatus() *CardUpdate {
|
|
||||||
cu.mutation.ClearStatus()
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetToken sets the "token" field.
|
|
||||||
func (cu *CardUpdate) SetToken(s string) *CardUpdate {
|
|
||||||
cu.mutation.SetToken(s)
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableToken sets the "token" field if the given value is not nil.
|
|
||||||
func (cu *CardUpdate) SetNillableToken(s *string) *CardUpdate {
|
|
||||||
if s != nil {
|
|
||||||
cu.SetToken(*s)
|
|
||||||
}
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearToken clears the value of the "token" field.
|
|
||||||
func (cu *CardUpdate) ClearToken() *CardUpdate {
|
|
||||||
cu.mutation.ClearToken()
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCp sets the "cp" field.
|
|
||||||
func (cu *CardUpdate) SetCp(i int) *CardUpdate {
|
|
||||||
cu.mutation.ResetCp()
|
|
||||||
cu.mutation.SetCp(i)
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableCp sets the "cp" field if the given value is not nil.
|
|
||||||
func (cu *CardUpdate) SetNillableCp(i *int) *CardUpdate {
|
|
||||||
if i != nil {
|
|
||||||
cu.SetCp(*i)
|
|
||||||
}
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddCp adds i to the "cp" field.
|
|
||||||
func (cu *CardUpdate) AddCp(i int) *CardUpdate {
|
|
||||||
cu.mutation.AddCp(i)
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearCp clears the value of the "cp" field.
|
|
||||||
func (cu *CardUpdate) ClearCp() *CardUpdate {
|
|
||||||
cu.mutation.ClearCp()
|
|
||||||
return cu
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetOwnerID sets the "owner" edge to the User entity by ID.
|
// SetOwnerID sets the "owner" edge to the User entity by ID.
|
||||||
func (cu *CardUpdate) SetOwnerID(id int) *CardUpdate {
|
func (cu *CardUpdate) SetOwnerID(id int) *CardUpdate {
|
||||||
cu.mutation.SetOwnerID(id)
|
cu.mutation.SetOwnerID(id)
|
||||||
@@ -187,30 +100,9 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
if cu.mutation.CardCleared() {
|
if cu.mutation.CardCleared() {
|
||||||
_spec.ClearField(card.FieldCard, field.TypeInt)
|
_spec.ClearField(card.FieldCard, field.TypeInt)
|
||||||
}
|
}
|
||||||
if value, ok := cu.mutation.Skill(); ok {
|
|
||||||
_spec.SetField(card.FieldSkill, field.TypeString, value)
|
|
||||||
}
|
|
||||||
if cu.mutation.SkillCleared() {
|
|
||||||
_spec.ClearField(card.FieldSkill, field.TypeString)
|
|
||||||
}
|
|
||||||
if value, ok := cu.mutation.Status(); ok {
|
|
||||||
_spec.SetField(card.FieldStatus, field.TypeString, value)
|
|
||||||
}
|
|
||||||
if cu.mutation.StatusCleared() {
|
if cu.mutation.StatusCleared() {
|
||||||
_spec.ClearField(card.FieldStatus, field.TypeString)
|
_spec.ClearField(card.FieldStatus, field.TypeString)
|
||||||
}
|
}
|
||||||
if value, ok := cu.mutation.Token(); ok {
|
|
||||||
_spec.SetField(card.FieldToken, field.TypeString, value)
|
|
||||||
}
|
|
||||||
if cu.mutation.TokenCleared() {
|
|
||||||
_spec.ClearField(card.FieldToken, field.TypeString)
|
|
||||||
}
|
|
||||||
if value, ok := cu.mutation.Cp(); ok {
|
|
||||||
_spec.SetField(card.FieldCp, field.TypeInt, value)
|
|
||||||
}
|
|
||||||
if value, ok := cu.mutation.AddedCp(); ok {
|
|
||||||
_spec.AddField(card.FieldCp, field.TypeInt, value)
|
|
||||||
}
|
|
||||||
if cu.mutation.CpCleared() {
|
if cu.mutation.CpCleared() {
|
||||||
_spec.ClearField(card.FieldCp, field.TypeInt)
|
_spec.ClearField(card.FieldCp, field.TypeInt)
|
||||||
}
|
}
|
||||||
@@ -228,7 +120,10 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
Columns: []string{card.OwnerColumn},
|
Columns: []string{card.OwnerColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
@@ -241,7 +136,10 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
Columns: []string{card.OwnerColumn},
|
Columns: []string{card.OwnerColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
@@ -269,93 +167,6 @@ type CardUpdateOne struct {
|
|||||||
mutation *CardMutation
|
mutation *CardMutation
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSkill sets the "skill" field.
|
|
||||||
func (cuo *CardUpdateOne) SetSkill(s string) *CardUpdateOne {
|
|
||||||
cuo.mutation.SetSkill(s)
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableSkill sets the "skill" field if the given value is not nil.
|
|
||||||
func (cuo *CardUpdateOne) SetNillableSkill(s *string) *CardUpdateOne {
|
|
||||||
if s != nil {
|
|
||||||
cuo.SetSkill(*s)
|
|
||||||
}
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearSkill clears the value of the "skill" field.
|
|
||||||
func (cuo *CardUpdateOne) ClearSkill() *CardUpdateOne {
|
|
||||||
cuo.mutation.ClearSkill()
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetStatus sets the "status" field.
|
|
||||||
func (cuo *CardUpdateOne) SetStatus(s string) *CardUpdateOne {
|
|
||||||
cuo.mutation.SetStatus(s)
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
||||||
func (cuo *CardUpdateOne) SetNillableStatus(s *string) *CardUpdateOne {
|
|
||||||
if s != nil {
|
|
||||||
cuo.SetStatus(*s)
|
|
||||||
}
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearStatus clears the value of the "status" field.
|
|
||||||
func (cuo *CardUpdateOne) ClearStatus() *CardUpdateOne {
|
|
||||||
cuo.mutation.ClearStatus()
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetToken sets the "token" field.
|
|
||||||
func (cuo *CardUpdateOne) SetToken(s string) *CardUpdateOne {
|
|
||||||
cuo.mutation.SetToken(s)
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableToken sets the "token" field if the given value is not nil.
|
|
||||||
func (cuo *CardUpdateOne) SetNillableToken(s *string) *CardUpdateOne {
|
|
||||||
if s != nil {
|
|
||||||
cuo.SetToken(*s)
|
|
||||||
}
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearToken clears the value of the "token" field.
|
|
||||||
func (cuo *CardUpdateOne) ClearToken() *CardUpdateOne {
|
|
||||||
cuo.mutation.ClearToken()
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCp sets the "cp" field.
|
|
||||||
func (cuo *CardUpdateOne) SetCp(i int) *CardUpdateOne {
|
|
||||||
cuo.mutation.ResetCp()
|
|
||||||
cuo.mutation.SetCp(i)
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableCp sets the "cp" field if the given value is not nil.
|
|
||||||
func (cuo *CardUpdateOne) SetNillableCp(i *int) *CardUpdateOne {
|
|
||||||
if i != nil {
|
|
||||||
cuo.SetCp(*i)
|
|
||||||
}
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddCp adds i to the "cp" field.
|
|
||||||
func (cuo *CardUpdateOne) AddCp(i int) *CardUpdateOne {
|
|
||||||
cuo.mutation.AddCp(i)
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearCp clears the value of the "cp" field.
|
|
||||||
func (cuo *CardUpdateOne) ClearCp() *CardUpdateOne {
|
|
||||||
cuo.mutation.ClearCp()
|
|
||||||
return cuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetOwnerID sets the "owner" edge to the User entity by ID.
|
// SetOwnerID sets the "owner" edge to the User entity by ID.
|
||||||
func (cuo *CardUpdateOne) SetOwnerID(id int) *CardUpdateOne {
|
func (cuo *CardUpdateOne) SetOwnerID(id int) *CardUpdateOne {
|
||||||
cuo.mutation.SetOwnerID(id)
|
cuo.mutation.SetOwnerID(id)
|
||||||
@@ -458,30 +269,9 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error)
|
|||||||
if cuo.mutation.CardCleared() {
|
if cuo.mutation.CardCleared() {
|
||||||
_spec.ClearField(card.FieldCard, field.TypeInt)
|
_spec.ClearField(card.FieldCard, field.TypeInt)
|
||||||
}
|
}
|
||||||
if value, ok := cuo.mutation.Skill(); ok {
|
|
||||||
_spec.SetField(card.FieldSkill, field.TypeString, value)
|
|
||||||
}
|
|
||||||
if cuo.mutation.SkillCleared() {
|
|
||||||
_spec.ClearField(card.FieldSkill, field.TypeString)
|
|
||||||
}
|
|
||||||
if value, ok := cuo.mutation.Status(); ok {
|
|
||||||
_spec.SetField(card.FieldStatus, field.TypeString, value)
|
|
||||||
}
|
|
||||||
if cuo.mutation.StatusCleared() {
|
if cuo.mutation.StatusCleared() {
|
||||||
_spec.ClearField(card.FieldStatus, field.TypeString)
|
_spec.ClearField(card.FieldStatus, field.TypeString)
|
||||||
}
|
}
|
||||||
if value, ok := cuo.mutation.Token(); ok {
|
|
||||||
_spec.SetField(card.FieldToken, field.TypeString, value)
|
|
||||||
}
|
|
||||||
if cuo.mutation.TokenCleared() {
|
|
||||||
_spec.ClearField(card.FieldToken, field.TypeString)
|
|
||||||
}
|
|
||||||
if value, ok := cuo.mutation.Cp(); ok {
|
|
||||||
_spec.SetField(card.FieldCp, field.TypeInt, value)
|
|
||||||
}
|
|
||||||
if value, ok := cuo.mutation.AddedCp(); ok {
|
|
||||||
_spec.AddField(card.FieldCp, field.TypeInt, value)
|
|
||||||
}
|
|
||||||
if cuo.mutation.CpCleared() {
|
if cuo.mutation.CpCleared() {
|
||||||
_spec.ClearField(card.FieldCp, field.TypeInt)
|
_spec.ClearField(card.FieldCp, field.TypeInt)
|
||||||
}
|
}
|
||||||
@@ -499,7 +289,10 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error)
|
|||||||
Columns: []string{card.OwnerColumn},
|
Columns: []string{card.OwnerColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
@@ -512,7 +305,10 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error)
|
|||||||
Columns: []string{card.OwnerColumn},
|
Columns: []string{card.OwnerColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
|
@@ -509,7 +509,7 @@ func withHooks[V Value, M any, PM interface {
|
|||||||
return exec(ctx)
|
return exec(ctx)
|
||||||
}
|
}
|
||||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||||
mutationT, ok := any(m).(PM)
|
mutationT, ok := m.(PM)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||||
}
|
}
|
||||||
|
12
ent/group.go
12
ent/group.go
@@ -17,8 +17,6 @@ type Group struct {
|
|||||||
ID int `json:"id,omitempty"`
|
ID int `json:"id,omitempty"`
|
||||||
// Name holds the value of the "name" field.
|
// Name holds the value of the "name" field.
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
// Password holds the value of the "password" field.
|
|
||||||
Password string `json:"-"`
|
|
||||||
// Edges holds the relations/edges for other nodes in the graph.
|
// Edges holds the relations/edges for other nodes in the graph.
|
||||||
// The values are being populated by the GroupQuery when eager-loading is set.
|
// The values are being populated by the GroupQuery when eager-loading is set.
|
||||||
Edges GroupEdges `json:"edges"`
|
Edges GroupEdges `json:"edges"`
|
||||||
@@ -49,7 +47,7 @@ func (*Group) scanValues(columns []string) ([]any, error) {
|
|||||||
switch columns[i] {
|
switch columns[i] {
|
||||||
case group.FieldID:
|
case group.FieldID:
|
||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case group.FieldName, group.FieldPassword:
|
case group.FieldName:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unexpected column %q for type Group", columns[i])
|
return nil, fmt.Errorf("unexpected column %q for type Group", columns[i])
|
||||||
@@ -78,12 +76,6 @@ func (gr *Group) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
gr.Name = value.String
|
gr.Name = value.String
|
||||||
}
|
}
|
||||||
case group.FieldPassword:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field password", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
gr.Password = value.String
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -119,8 +111,6 @@ func (gr *Group) String() string {
|
|||||||
builder.WriteString(fmt.Sprintf("id=%v, ", gr.ID))
|
builder.WriteString(fmt.Sprintf("id=%v, ", gr.ID))
|
||||||
builder.WriteString("name=")
|
builder.WriteString("name=")
|
||||||
builder.WriteString(gr.Name)
|
builder.WriteString(gr.Name)
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("password=<sensitive>")
|
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
@@ -9,8 +9,6 @@ const (
|
|||||||
FieldID = "id"
|
FieldID = "id"
|
||||||
// FieldName holds the string denoting the name field in the database.
|
// FieldName holds the string denoting the name field in the database.
|
||||||
FieldName = "name"
|
FieldName = "name"
|
||||||
// FieldPassword holds the string denoting the password field in the database.
|
|
||||||
FieldPassword = "password"
|
|
||||||
// EdgeUsers holds the string denoting the users edge name in mutations.
|
// EdgeUsers holds the string denoting the users edge name in mutations.
|
||||||
EdgeUsers = "users"
|
EdgeUsers = "users"
|
||||||
// Table holds the table name of the group in the database.
|
// Table holds the table name of the group in the database.
|
||||||
@@ -28,7 +26,6 @@ const (
|
|||||||
var Columns = []string{
|
var Columns = []string{
|
||||||
FieldID,
|
FieldID,
|
||||||
FieldName,
|
FieldName,
|
||||||
FieldPassword,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
@@ -40,8 +37,3 @@ func ValidColumn(column string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
||||||
PasswordValidator func(string) error
|
|
||||||
)
|
|
||||||
|
@@ -59,11 +59,6 @@ func Name(v string) predicate.Group {
|
|||||||
return predicate.Group(sql.FieldEQ(FieldName, v))
|
return predicate.Group(sql.FieldEQ(FieldName, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Password applies equality check predicate on the "password" field. It's identical to PasswordEQ.
|
|
||||||
func Password(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldEQ(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// NameEQ applies the EQ predicate on the "name" field.
|
// NameEQ applies the EQ predicate on the "name" field.
|
||||||
func NameEQ(v string) predicate.Group {
|
func NameEQ(v string) predicate.Group {
|
||||||
return predicate.Group(sql.FieldEQ(FieldName, v))
|
return predicate.Group(sql.FieldEQ(FieldName, v))
|
||||||
@@ -129,71 +124,6 @@ func NameContainsFold(v string) predicate.Group {
|
|||||||
return predicate.Group(sql.FieldContainsFold(FieldName, v))
|
return predicate.Group(sql.FieldContainsFold(FieldName, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PasswordEQ applies the EQ predicate on the "password" field.
|
|
||||||
func PasswordEQ(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldEQ(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordNEQ applies the NEQ predicate on the "password" field.
|
|
||||||
func PasswordNEQ(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldNEQ(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordIn applies the In predicate on the "password" field.
|
|
||||||
func PasswordIn(vs ...string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldIn(FieldPassword, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordNotIn applies the NotIn predicate on the "password" field.
|
|
||||||
func PasswordNotIn(vs ...string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldNotIn(FieldPassword, vs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordGT applies the GT predicate on the "password" field.
|
|
||||||
func PasswordGT(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldGT(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordGTE applies the GTE predicate on the "password" field.
|
|
||||||
func PasswordGTE(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldGTE(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordLT applies the LT predicate on the "password" field.
|
|
||||||
func PasswordLT(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldLT(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordLTE applies the LTE predicate on the "password" field.
|
|
||||||
func PasswordLTE(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldLTE(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordContains applies the Contains predicate on the "password" field.
|
|
||||||
func PasswordContains(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldContains(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordHasPrefix applies the HasPrefix predicate on the "password" field.
|
|
||||||
func PasswordHasPrefix(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldHasPrefix(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordHasSuffix applies the HasSuffix predicate on the "password" field.
|
|
||||||
func PasswordHasSuffix(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldHasSuffix(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordEqualFold applies the EqualFold predicate on the "password" field.
|
|
||||||
func PasswordEqualFold(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldEqualFold(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// PasswordContainsFold applies the ContainsFold predicate on the "password" field.
|
|
||||||
func PasswordContainsFold(v string) predicate.Group {
|
|
||||||
return predicate.Group(sql.FieldContainsFold(FieldPassword, v))
|
|
||||||
}
|
|
||||||
|
|
||||||
// HasUsers applies the HasEdge predicate on the "users" edge.
|
// HasUsers applies the HasEdge predicate on the "users" edge.
|
||||||
func HasUsers() predicate.Group {
|
func HasUsers() predicate.Group {
|
||||||
return predicate.Group(func(s *sql.Selector) {
|
return predicate.Group(func(s *sql.Selector) {
|
||||||
|
@@ -26,12 +26,6 @@ func (gc *GroupCreate) SetName(s string) *GroupCreate {
|
|||||||
return gc
|
return gc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPassword sets the "password" field.
|
|
||||||
func (gc *GroupCreate) SetPassword(s string) *GroupCreate {
|
|
||||||
gc.mutation.SetPassword(s)
|
|
||||||
return gc
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddUserIDs adds the "users" edge to the User entity by IDs.
|
// AddUserIDs adds the "users" edge to the User entity by IDs.
|
||||||
func (gc *GroupCreate) AddUserIDs(ids ...int) *GroupCreate {
|
func (gc *GroupCreate) AddUserIDs(ids ...int) *GroupCreate {
|
||||||
gc.mutation.AddUserIDs(ids...)
|
gc.mutation.AddUserIDs(ids...)
|
||||||
@@ -84,14 +78,6 @@ func (gc *GroupCreate) check() error {
|
|||||||
if _, ok := gc.mutation.Name(); !ok {
|
if _, ok := gc.mutation.Name(); !ok {
|
||||||
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Group.name"`)}
|
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Group.name"`)}
|
||||||
}
|
}
|
||||||
if _, ok := gc.mutation.Password(); !ok {
|
|
||||||
return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "Group.password"`)}
|
|
||||||
}
|
|
||||||
if v, ok := gc.mutation.Password(); ok {
|
|
||||||
if err := group.PasswordValidator(v); err != nil {
|
|
||||||
return &ValidationError{Name: "password", err: fmt.Errorf(`ent: validator failed for field "Group.password": %w`, err)}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,10 +108,6 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(group.FieldName, field.TypeString, value)
|
_spec.SetField(group.FieldName, field.TypeString, value)
|
||||||
_node.Name = value
|
_node.Name = value
|
||||||
}
|
}
|
||||||
if value, ok := gc.mutation.Password(); ok {
|
|
||||||
_spec.SetField(group.FieldPassword, field.TypeString, value)
|
|
||||||
_node.Password = value
|
|
||||||
}
|
|
||||||
if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 {
|
if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
@@ -134,7 +116,10 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
|
|||||||
Columns: []string{group.UsersColumn},
|
Columns: []string{group.UsersColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
|
@@ -122,7 +122,10 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
Columns: []string{group.UsersColumn},
|
Columns: []string{group.UsersColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
@@ -135,7 +138,10 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
Columns: []string{group.UsersColumn},
|
Columns: []string{group.UsersColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
@@ -151,7 +157,10 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
Columns: []string{group.UsersColumn},
|
Columns: []string{group.UsersColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
@@ -303,7 +312,10 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
|
|||||||
Columns: []string{group.UsersColumn},
|
Columns: []string{group.UsersColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
@@ -316,7 +328,10 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
|
|||||||
Columns: []string{group.UsersColumn},
|
Columns: []string{group.UsersColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
@@ -332,7 +347,10 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error
|
|||||||
Columns: []string{group.UsersColumn},
|
Columns: []string{group.UsersColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: user.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
-- Create "cards" table
|
|
||||||
CREATE TABLE `cards` (`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, `password` text NOT NULL, `card` integer NULL, `status` text NULL, `cp` integer NULL, `url` text NULL DEFAULT 'https://card.syui.ai', `created_at` datetime NULL, `user_card` integer NOT NULL, CONSTRAINT `cards_users_card` FOREIGN KEY (`user_card`) REFERENCES `users` (`id`) ON DELETE NO ACTION);
|
|
||||||
-- Create "groups" table
|
|
||||||
CREATE TABLE `groups` (`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, `name` text NOT NULL, `password` text NOT NULL);
|
|
||||||
-- Create index "group_name" to table: "groups"
|
|
||||||
CREATE UNIQUE INDEX `group_name` ON `groups` (`name`);
|
|
||||||
-- Create "users" table
|
|
||||||
CREATE TABLE `users` (`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, `username` text NOT NULL, `password` text NOT NULL, `created_at` datetime NULL, `updated_at` datetime NULL, `next` text NULL DEFAULT '20230405', `group_users` integer NULL, CONSTRAINT `users_groups_users` FOREIGN KEY (`group_users`) REFERENCES `groups` (`id`) ON DELETE SET NULL);
|
|
||||||
-- Create index "users_username_key" to table: "users"
|
|
||||||
CREATE UNIQUE INDEX `users_username_key` ON `users` (`username`);
|
|
||||||
-- Create index "user_username" to table: "users"
|
|
||||||
CREATE UNIQUE INDEX `user_username` ON `users` (`username`);
|
|
@@ -1,2 +0,0 @@
|
|||||||
h1:GU79ffcSbQHeq4BLGuuAdObBOt0WLTcsQx+AucxEqkA=
|
|
||||||
20230405104340_migration_name.sql h1:vlsZT8ob1qpLmBAGPqNBBG/iFact7wy1pb27tAavvRU=
|
|
@@ -11,11 +11,8 @@ var (
|
|||||||
// CardsColumns holds the columns for the "cards" table.
|
// CardsColumns holds the columns for the "cards" table.
|
||||||
CardsColumns = []*schema.Column{
|
CardsColumns = []*schema.Column{
|
||||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||||
{Name: "password", Type: field.TypeString},
|
|
||||||
{Name: "card", Type: field.TypeInt, Nullable: true},
|
{Name: "card", Type: field.TypeInt, Nullable: true},
|
||||||
{Name: "skill", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "status", Type: field.TypeString, Nullable: true},
|
{Name: "status", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "token", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "cp", Type: field.TypeInt, Nullable: true},
|
{Name: "cp", Type: field.TypeInt, Nullable: true},
|
||||||
{Name: "url", Type: field.TypeString, Nullable: true, Default: "https://card.syui.ai"},
|
{Name: "url", Type: field.TypeString, Nullable: true, Default: "https://card.syui.ai"},
|
||||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||||
@@ -29,7 +26,7 @@ var (
|
|||||||
ForeignKeys: []*schema.ForeignKey{
|
ForeignKeys: []*schema.ForeignKey{
|
||||||
{
|
{
|
||||||
Symbol: "cards_users_card",
|
Symbol: "cards_users_card",
|
||||||
Columns: []*schema.Column{CardsColumns[9]},
|
Columns: []*schema.Column{CardsColumns[6]},
|
||||||
RefColumns: []*schema.Column{UsersColumns[0]},
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
||||||
OnDelete: schema.NoAction,
|
OnDelete: schema.NoAction,
|
||||||
},
|
},
|
||||||
@@ -39,7 +36,6 @@ var (
|
|||||||
GroupsColumns = []*schema.Column{
|
GroupsColumns = []*schema.Column{
|
||||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||||
{Name: "name", Type: field.TypeString},
|
{Name: "name", Type: field.TypeString},
|
||||||
{Name: "password", Type: field.TypeString},
|
|
||||||
}
|
}
|
||||||
// GroupsTable holds the schema information for the "groups" table.
|
// GroupsTable holds the schema information for the "groups" table.
|
||||||
GroupsTable = &schema.Table{
|
GroupsTable = &schema.Table{
|
||||||
@@ -57,33 +53,10 @@ var (
|
|||||||
// UsersColumns holds the columns for the "users" table.
|
// UsersColumns holds the columns for the "users" table.
|
||||||
UsersColumns = []*schema.Column{
|
UsersColumns = []*schema.Column{
|
||||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||||
{Name: "username", Type: field.TypeString, Unique: true, Size: 100},
|
{Name: "username", Type: field.TypeString, Unique: true, Size: 30},
|
||||||
{Name: "did", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "bsky", Type: field.TypeBool, Nullable: true, Default: false},
|
|
||||||
{Name: "mastodon", Type: field.TypeBool, Nullable: true, Default: true},
|
|
||||||
{Name: "delete", Type: field.TypeBool, Nullable: true, Default: false},
|
|
||||||
{Name: "handle", Type: field.TypeBool, Nullable: true, Default: false},
|
|
||||||
{Name: "token", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "password", Type: field.TypeString},
|
|
||||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||||
{Name: "raid_at", Type: field.TypeTime, Nullable: true},
|
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230404"},
|
||||||
{Name: "luck", Type: field.TypeInt, Nullable: true},
|
|
||||||
{Name: "luck_at", Type: field.TypeTime, Nullable: true},
|
|
||||||
{Name: "like", Type: field.TypeInt, Nullable: true},
|
|
||||||
{Name: "like_rank", Type: field.TypeInt, Nullable: true},
|
|
||||||
{Name: "like_at", Type: field.TypeTime, Nullable: true},
|
|
||||||
{Name: "fav", Type: field.TypeInt, Nullable: true},
|
|
||||||
{Name: "ten", Type: field.TypeBool, Nullable: true},
|
|
||||||
{Name: "ten_su", Type: field.TypeInt, Nullable: true},
|
|
||||||
{Name: "ten_kai", Type: field.TypeInt, Nullable: true},
|
|
||||||
{Name: "aiten", Type: field.TypeInt, Nullable: true},
|
|
||||||
{Name: "ten_card", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "ten_delete", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "ten_post", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "ten_get", Type: field.TypeString, Nullable: true},
|
|
||||||
{Name: "ten_at", Type: field.TypeTime, Nullable: true},
|
|
||||||
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20230710"},
|
|
||||||
{Name: "group_users", Type: field.TypeInt, Nullable: true},
|
{Name: "group_users", Type: field.TypeInt, Nullable: true},
|
||||||
}
|
}
|
||||||
// UsersTable holds the schema information for the "users" table.
|
// UsersTable holds the schema information for the "users" table.
|
||||||
@@ -94,7 +67,7 @@ var (
|
|||||||
ForeignKeys: []*schema.ForeignKey{
|
ForeignKeys: []*schema.ForeignKey{
|
||||||
{
|
{
|
||||||
Symbol: "users_groups_users",
|
Symbol: "users_groups_users",
|
||||||
Columns: []*schema.Column{UsersColumns[28]},
|
Columns: []*schema.Column{UsersColumns[5]},
|
||||||
RefColumns: []*schema.Column{GroupsColumns[0]},
|
RefColumns: []*schema.Column{GroupsColumns[0]},
|
||||||
OnDelete: schema.SetNull,
|
OnDelete: schema.SetNull,
|
||||||
},
|
},
|
||||||
|
2163
ent/mutation.go
2163
ent/mutation.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -459,7 +459,7 @@ func decodeListCardParams(args [0]string, r *http.Request) (params ListCardParam
|
|||||||
MinSet: true,
|
MinSet: true,
|
||||||
Min: 1,
|
Min: 1,
|
||||||
MaxSet: true,
|
MaxSet: true,
|
||||||
Max: 4000,
|
Max: 255,
|
||||||
MinExclusive: false,
|
MinExclusive: false,
|
||||||
MaxExclusive: false,
|
MaxExclusive: false,
|
||||||
MultipleOfSet: false,
|
MultipleOfSet: false,
|
||||||
@@ -624,7 +624,7 @@ func decodeListGroupParams(args [0]string, r *http.Request) (params ListGroupPar
|
|||||||
MinSet: true,
|
MinSet: true,
|
||||||
Min: 1,
|
Min: 1,
|
||||||
MaxSet: true,
|
MaxSet: true,
|
||||||
Max: 4000,
|
Max: 255,
|
||||||
MinExclusive: false,
|
MinExclusive: false,
|
||||||
MaxExclusive: false,
|
MaxExclusive: false,
|
||||||
MultipleOfSet: false,
|
MultipleOfSet: false,
|
||||||
@@ -956,7 +956,7 @@ func decodeListUserParams(args [0]string, r *http.Request) (params ListUserParam
|
|||||||
MinSet: true,
|
MinSet: true,
|
||||||
Min: 1,
|
Min: 1,
|
||||||
MaxSet: true,
|
MaxSet: true,
|
||||||
Max: 4000,
|
Max: 255,
|
||||||
MinExclusive: false,
|
MinExclusive: false,
|
||||||
MaxExclusive: false,
|
MaxExclusive: false,
|
||||||
MultipleOfSet: false,
|
MultipleOfSet: false,
|
||||||
|
@@ -374,7 +374,6 @@ func encodeDrawStartResponse(response *DrawStartNoContent, w http.ResponseWriter
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error {
|
func encodeListCardResponse(response ListCardRes, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
switch response := response.(type) {
|
switch response := response.(type) {
|
||||||
case *ListCardOKApplicationJSON:
|
case *ListCardOKApplicationJSON:
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
@@ -576,7 +575,6 @@ func encodeListGroupUsersResponse(response ListGroupUsersRes, w http.ResponseWri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error {
|
func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
switch response := response.(type) {
|
switch response := response.(type) {
|
||||||
case *ListUserOKApplicationJSON:
|
case *ListUserOKApplicationJSON:
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
@@ -644,7 +642,6 @@ func encodeListUserResponse(response ListUserRes, w http.ResponseWriter, span tr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error {
|
func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
switch response := response.(type) {
|
switch response := response.(type) {
|
||||||
case *ListUserCardOKApplicationJSON:
|
case *ListUserCardOKApplicationJSON:
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
@@ -712,7 +709,6 @@ func encodeListUserCardResponse(response ListUserCardRes, w http.ResponseWriter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error {
|
func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
switch response := response.(type) {
|
switch response := response.(type) {
|
||||||
case *CardRead:
|
case *CardRead:
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
@@ -780,7 +776,6 @@ func encodeReadCardResponse(response ReadCardRes, w http.ResponseWriter, span tr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error {
|
func encodeReadCardOwnerResponse(response ReadCardOwnerRes, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
switch response := response.(type) {
|
switch response := response.(type) {
|
||||||
case *CardOwnerRead:
|
case *CardOwnerRead:
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
@@ -915,7 +910,6 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
|
|||||||
}
|
}
|
||||||
|
|
||||||
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
|
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
switch response := response.(type) {
|
switch response := response.(type) {
|
||||||
case *UserRead:
|
case *UserRead:
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -12,13 +12,8 @@ import (
|
|||||||
"t/ent/user"
|
"t/ent/user"
|
||||||
|
|
||||||
"github.com/go-faster/jx"
|
"github.com/go-faster/jx"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// origin-config
|
|
||||||
var password = os.Getenv("PASS")
|
|
||||||
var token = os.Getenv("TOKEN")
|
|
||||||
|
|
||||||
// OgentHandler implements the ogen generated Handler interface and uses Ent as data layer.
|
// OgentHandler implements the ogen generated Handler interface and uses Ent as data layer.
|
||||||
type OgentHandler struct {
|
type OgentHandler struct {
|
||||||
client *ent.Client
|
client *ent.Client
|
||||||
@@ -38,13 +33,9 @@ func rawError(err error) jx.Raw {
|
|||||||
func (h *OgentHandler) CreateCard(ctx context.Context, req *CreateCardReq) (CreateCardRes, error) {
|
func (h *OgentHandler) CreateCard(ctx context.Context, req *CreateCardReq) (CreateCardRes, error) {
|
||||||
b := h.client.Card.Create()
|
b := h.client.Card.Create()
|
||||||
// Add all fields.
|
// Add all fields.
|
||||||
b.SetPassword(req.Password)
|
|
||||||
if v, ok := req.Card.Get(); ok {
|
if v, ok := req.Card.Get(); ok {
|
||||||
b.SetCard(v)
|
b.SetCard(v)
|
||||||
}
|
}
|
||||||
if v, ok := req.Skill.Get(); ok {
|
|
||||||
b.SetSkill(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Status.Get(); ok {
|
if v, ok := req.Status.Get(); ok {
|
||||||
b.SetStatus(v)
|
b.SetStatus(v)
|
||||||
}
|
}
|
||||||
@@ -58,13 +49,7 @@ func (h *OgentHandler) CreateCard(ctx context.Context, req *CreateCardReq) (Crea
|
|||||||
b.SetCreatedAt(v)
|
b.SetCreatedAt(v)
|
||||||
}
|
}
|
||||||
// Add all edges.
|
// Add all edges.
|
||||||
//b.SetOwnerID(req.Owner)
|
b.SetOwnerID(req.Owner)
|
||||||
// origin-config
|
|
||||||
if req.Password == password {
|
|
||||||
b.SetOwnerID(req.Owner)
|
|
||||||
} else {
|
|
||||||
b.SetOwnerID(0)
|
|
||||||
}
|
|
||||||
// Persist to storage.
|
// Persist to storage.
|
||||||
e, err := b.Save(ctx)
|
e, err := b.Save(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -125,27 +110,11 @@ func (h *OgentHandler) ReadCard(ctx context.Context, params ReadCardParams) (Rea
|
|||||||
// UpdateCard handles PATCH /cards/{id} requests.
|
// UpdateCard handles PATCH /cards/{id} requests.
|
||||||
func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, params UpdateCardParams) (UpdateCardRes, error) {
|
func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, params UpdateCardParams) (UpdateCardRes, error) {
|
||||||
b := h.client.Card.UpdateOneID(params.ID)
|
b := h.client.Card.UpdateOneID(params.ID)
|
||||||
if v, ok := req.Token.Get(); ok {
|
// Add all fields.
|
||||||
if v == token {
|
// Add all edges.
|
||||||
b.SetToken(v)
|
if v, ok := req.Owner.Get(); ok {
|
||||||
if v, ok := req.Skill.Get(); ok {
|
b.SetOwnerID(v)
|
||||||
b.SetSkill(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Status.Get(); ok {
|
|
||||||
b.SetStatus(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Token.Get(); ok {
|
|
||||||
b.SetToken(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Cp.Get(); ok {
|
|
||||||
b.SetCp(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Owner.Get(); ok {
|
|
||||||
b.SetOwnerID(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Persist to storage.
|
// Persist to storage.
|
||||||
e, err := b.Save(ctx)
|
e, err := b.Save(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -179,7 +148,7 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
|
|||||||
|
|
||||||
// DeleteCard handles DELETE /cards/{id} requests.
|
// DeleteCard handles DELETE /cards/{id} requests.
|
||||||
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
|
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
|
||||||
err := h.client.Card.DeleteOneID(0).Exec(ctx)
|
err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
case ent.IsNotFound(err):
|
case ent.IsNotFound(err):
|
||||||
@@ -270,8 +239,7 @@ func (h *OgentHandler) ReadCardOwner(ctx context.Context, params ReadCardOwnerPa
|
|||||||
func (h *OgentHandler) CreateGroup(ctx context.Context, req *CreateGroupReq) (CreateGroupRes, error) {
|
func (h *OgentHandler) CreateGroup(ctx context.Context, req *CreateGroupReq) (CreateGroupRes, error) {
|
||||||
b := h.client.Group.Create()
|
b := h.client.Group.Create()
|
||||||
// Add all fields.
|
// Add all fields.
|
||||||
b.SetName("")
|
b.SetName(req.Name)
|
||||||
b.SetPassword(req.Password)
|
|
||||||
// Add all edges.
|
// Add all edges.
|
||||||
b.AddUserIDs(req.Users...)
|
b.AddUserIDs(req.Users...)
|
||||||
// Persist to storage.
|
// Persist to storage.
|
||||||
@@ -333,7 +301,7 @@ func (h *OgentHandler) ReadGroup(ctx context.Context, params ReadGroupParams) (R
|
|||||||
|
|
||||||
// UpdateGroup handles PATCH /groups/{id} requests.
|
// UpdateGroup handles PATCH /groups/{id} requests.
|
||||||
func (h *OgentHandler) UpdateGroup(ctx context.Context, req *UpdateGroupReq, params UpdateGroupParams) (UpdateGroupRes, error) {
|
func (h *OgentHandler) UpdateGroup(ctx context.Context, req *UpdateGroupReq, params UpdateGroupParams) (UpdateGroupRes, error) {
|
||||||
b := h.client.Group.UpdateOneID(0)
|
b := h.client.Group.UpdateOneID(params.ID)
|
||||||
// Add all fields.
|
// Add all fields.
|
||||||
if v, ok := req.Name.Get(); ok {
|
if v, ok := req.Name.Get(); ok {
|
||||||
b.SetName(v)
|
b.SetName(v)
|
||||||
@@ -375,7 +343,7 @@ func (h *OgentHandler) UpdateGroup(ctx context.Context, req *UpdateGroupReq, par
|
|||||||
|
|
||||||
// DeleteGroup handles DELETE /groups/{id} requests.
|
// DeleteGroup handles DELETE /groups/{id} requests.
|
||||||
func (h *OgentHandler) DeleteGroup(ctx context.Context, params DeleteGroupParams) (DeleteGroupRes, error) {
|
func (h *OgentHandler) DeleteGroup(ctx context.Context, params DeleteGroupParams) (DeleteGroupRes, error) {
|
||||||
err := h.client.Group.DeleteOneID(0).Exec(ctx)
|
err := h.client.Group.DeleteOneID(params.ID).Exec(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
case ent.IsNotFound(err):
|
case ent.IsNotFound(err):
|
||||||
@@ -475,91 +443,14 @@ func (h *OgentHandler) ListGroupUsers(ctx context.Context, params ListGroupUsers
|
|||||||
// CreateUser handles POST /users requests.
|
// CreateUser handles POST /users requests.
|
||||||
func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (CreateUserRes, error) {
|
func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (CreateUserRes, error) {
|
||||||
b := h.client.User.Create()
|
b := h.client.User.Create()
|
||||||
|
|
||||||
// Add all fields.
|
// Add all fields.
|
||||||
//b.SetUsername(req.Username)
|
b.SetUsername(req.Username)
|
||||||
//origin-config
|
|
||||||
if req.Password == password {
|
|
||||||
b.SetUsername(req.Username)
|
|
||||||
} else {
|
|
||||||
b.SetUsername("")
|
|
||||||
}
|
|
||||||
|
|
||||||
b.SetPassword(req.Password)
|
|
||||||
|
|
||||||
if v, ok := req.Fav.Get(); ok {
|
|
||||||
b.SetFav(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Did.Get(); ok {
|
|
||||||
b.SetDid(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Bsky.Get(); ok {
|
|
||||||
b.SetBsky(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Mastodon.Get(); ok {
|
|
||||||
b.SetMastodon(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
if v, ok := req.Delete.Get(); ok {
|
|
||||||
b.SetDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Handle.Get(); ok {
|
|
||||||
b.SetHandle(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Token.Get(); ok {
|
|
||||||
b.SetToken(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.CreatedAt.Get(); ok {
|
if v, ok := req.CreatedAt.Get(); ok {
|
||||||
b.SetCreatedAt(v)
|
b.SetCreatedAt(v)
|
||||||
}
|
}
|
||||||
if v, ok := req.UpdatedAt.Get(); ok {
|
if v, ok := req.UpdatedAt.Get(); ok {
|
||||||
b.SetUpdatedAt(v)
|
b.SetUpdatedAt(v)
|
||||||
}
|
}
|
||||||
if v, ok := req.RaidAt.Get(); ok {
|
|
||||||
b.SetRaidAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Luck.Get(); ok {
|
|
||||||
b.SetLuck(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Aiten.Get(); ok {
|
|
||||||
b.SetAiten(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LuckAt.Get(); ok {
|
|
||||||
b.SetLuckAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Like.Get(); ok {
|
|
||||||
b.SetLike(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeRank.Get(); ok {
|
|
||||||
b.SetLikeRank(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeAt.Get(); ok {
|
|
||||||
b.SetLikeAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Ten.Get(); ok {
|
|
||||||
b.SetTen(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenSu.Get(); ok {
|
|
||||||
b.SetTenSu(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenKai.Get(); ok {
|
|
||||||
b.SetTenKai(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenCard.Get(); ok {
|
|
||||||
b.SetTenCard(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenDelete.Get(); ok {
|
|
||||||
b.SetTenDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenPost.Get(); ok {
|
|
||||||
b.SetTenPost(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenGet.Get(); ok {
|
|
||||||
b.SetTenGet(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenAt.Get(); ok {
|
|
||||||
b.SetTenAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Next.Get(); ok {
|
if v, ok := req.Next.Get(); ok {
|
||||||
b.SetNext(v)
|
b.SetNext(v)
|
||||||
}
|
}
|
||||||
@@ -625,87 +516,17 @@ func (h *OgentHandler) ReadUser(ctx context.Context, params ReadUserParams) (Rea
|
|||||||
// UpdateUser handles PATCH /users/{id} requests.
|
// UpdateUser handles PATCH /users/{id} requests.
|
||||||
func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, params UpdateUserParams) (UpdateUserRes, error) {
|
func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, params UpdateUserParams) (UpdateUserRes, error) {
|
||||||
b := h.client.User.UpdateOneID(params.ID)
|
b := h.client.User.UpdateOneID(params.ID)
|
||||||
|
// Add all fields.
|
||||||
if v, ok := req.Token.Get(); ok {
|
if v, ok := req.UpdatedAt.Get(); ok {
|
||||||
if v == token {
|
b.SetUpdatedAt(v)
|
||||||
b.SetToken(v)
|
}
|
||||||
|
if v, ok := req.Next.Get(); ok {
|
||||||
if v, ok := req.Fav.Get(); ok {
|
b.SetNext(v)
|
||||||
b.SetFav(v)
|
}
|
||||||
}
|
// Add all edges.
|
||||||
if v, ok := req.Did.Get(); ok {
|
if req.Card != nil {
|
||||||
b.SetDid(v)
|
b.ClearCard().AddCardIDs(req.Card...)
|
||||||
}
|
|
||||||
if v, ok := req.Bsky.Get(); ok {
|
|
||||||
b.SetBsky(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Mastodon.Get(); ok {
|
|
||||||
b.SetMastodon(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Delete.Get(); ok {
|
|
||||||
b.SetDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Handle.Get(); ok {
|
|
||||||
b.SetHandle(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.UpdatedAt.Get(); ok {
|
|
||||||
b.SetUpdatedAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.RaidAt.Get(); ok {
|
|
||||||
b.SetRaidAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Aiten.Get(); ok {
|
|
||||||
b.SetAiten(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Luck.Get(); ok {
|
|
||||||
b.SetLuck(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LuckAt.Get(); ok {
|
|
||||||
b.SetLuckAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Like.Get(); ok {
|
|
||||||
b.SetLike(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeRank.Get(); ok {
|
|
||||||
b.SetLikeRank(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeAt.Get(); ok {
|
|
||||||
b.SetLikeAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Ten.Get(); ok {
|
|
||||||
b.SetTen(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenSu.Get(); ok {
|
|
||||||
b.SetTenSu(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenKai.Get(); ok {
|
|
||||||
b.SetTenKai(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenCard.Get(); ok {
|
|
||||||
b.SetTenCard(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenDelete.Get(); ok {
|
|
||||||
b.SetTenDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenPost.Get(); ok {
|
|
||||||
b.SetTenPost(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenGet.Get(); ok {
|
|
||||||
b.SetTenGet(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenAt.Get(); ok {
|
|
||||||
b.SetTenAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Next.Get(); ok {
|
|
||||||
b.SetNext(v)
|
|
||||||
}
|
|
||||||
// Add all edges.
|
|
||||||
if req.Card != nil {
|
|
||||||
b.ClearCard().AddCardIDs(req.Card...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Persist to storage.
|
// Persist to storage.
|
||||||
e, err := b.Save(ctx)
|
e, err := b.Save(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -739,7 +560,7 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
|
|||||||
|
|
||||||
// DeleteUser handles DELETE /users/{id} requests.
|
// DeleteUser handles DELETE /users/{id} requests.
|
||||||
func (h *OgentHandler) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) {
|
func (h *OgentHandler) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) {
|
||||||
err := h.client.User.DeleteOneID(0).Exec(ctx)
|
err := h.client.User.DeleteOneID(params.ID).Exec(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
case ent.IsNotFound(err):
|
case ent.IsNotFound(err):
|
||||||
|
@@ -11,7 +11,6 @@ func NewCardCreate(e *ent.Card) *CardCreate {
|
|||||||
var ret CardCreate
|
var ret CardCreate
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Card = NewOptInt(e.Card)
|
ret.Card = NewOptInt(e.Card)
|
||||||
ret.Skill = NewOptString(e.Skill)
|
|
||||||
ret.Status = NewOptString(e.Status)
|
ret.Status = NewOptString(e.Status)
|
||||||
ret.Cp = NewOptInt(e.Cp)
|
ret.Cp = NewOptInt(e.Cp)
|
||||||
ret.URL = NewOptString(e.URL)
|
ret.URL = NewOptString(e.URL)
|
||||||
@@ -44,7 +43,6 @@ func NewCardList(e *ent.Card) *CardList {
|
|||||||
var ret CardList
|
var ret CardList
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Card = NewOptInt(e.Card)
|
ret.Card = NewOptInt(e.Card)
|
||||||
ret.Skill = NewOptString(e.Skill)
|
|
||||||
ret.Status = NewOptString(e.Status)
|
ret.Status = NewOptString(e.Status)
|
||||||
ret.Cp = NewOptInt(e.Cp)
|
ret.Cp = NewOptInt(e.Cp)
|
||||||
ret.URL = NewOptString(e.URL)
|
ret.URL = NewOptString(e.URL)
|
||||||
@@ -77,7 +75,6 @@ func NewCardRead(e *ent.Card) *CardRead {
|
|||||||
var ret CardRead
|
var ret CardRead
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Card = NewOptInt(e.Card)
|
ret.Card = NewOptInt(e.Card)
|
||||||
ret.Skill = NewOptString(e.Skill)
|
|
||||||
ret.Status = NewOptString(e.Status)
|
ret.Status = NewOptString(e.Status)
|
||||||
ret.Cp = NewOptInt(e.Cp)
|
ret.Cp = NewOptInt(e.Cp)
|
||||||
ret.URL = NewOptString(e.URL)
|
ret.URL = NewOptString(e.URL)
|
||||||
@@ -110,7 +107,6 @@ func NewCardUpdate(e *ent.Card) *CardUpdate {
|
|||||||
var ret CardUpdate
|
var ret CardUpdate
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Card = NewOptInt(e.Card)
|
ret.Card = NewOptInt(e.Card)
|
||||||
ret.Skill = NewOptString(e.Skill)
|
|
||||||
ret.Status = NewOptString(e.Status)
|
ret.Status = NewOptString(e.Status)
|
||||||
ret.Cp = NewOptInt(e.Cp)
|
ret.Cp = NewOptInt(e.Cp)
|
||||||
ret.URL = NewOptString(e.URL)
|
ret.URL = NewOptString(e.URL)
|
||||||
@@ -143,29 +139,8 @@ func NewCardOwnerRead(e *ent.User) *CardOwnerRead {
|
|||||||
var ret CardOwnerRead
|
var ret CardOwnerRead
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Username = e.Username
|
ret.Username = e.Username
|
||||||
ret.Did = NewOptString(e.Did)
|
|
||||||
ret.Bsky = NewOptBool(e.Bsky)
|
|
||||||
ret.Mastodon = NewOptBool(e.Mastodon)
|
|
||||||
ret.Delete = NewOptBool(e.Delete)
|
|
||||||
ret.Handle = NewOptBool(e.Handle)
|
|
||||||
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
||||||
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
||||||
ret.RaidAt = NewOptDateTime(e.RaidAt)
|
|
||||||
ret.Luck = NewOptInt(e.Luck)
|
|
||||||
ret.LuckAt = NewOptDateTime(e.LuckAt)
|
|
||||||
ret.Like = NewOptInt(e.Like)
|
|
||||||
ret.LikeRank = NewOptInt(e.LikeRank)
|
|
||||||
ret.LikeAt = NewOptDateTime(e.LikeAt)
|
|
||||||
ret.Fav = NewOptInt(e.Fav)
|
|
||||||
ret.Ten = NewOptBool(e.Ten)
|
|
||||||
ret.TenSu = NewOptInt(e.TenSu)
|
|
||||||
ret.TenKai = NewOptInt(e.TenKai)
|
|
||||||
ret.Aiten = NewOptInt(e.Aiten)
|
|
||||||
ret.TenCard = NewOptString(e.TenCard)
|
|
||||||
ret.TenDelete = NewOptString(e.TenDelete)
|
|
||||||
ret.TenPost = NewOptString(e.TenPost)
|
|
||||||
ret.TenGet = NewOptString(e.TenGet)
|
|
||||||
ret.TenAt = NewOptDateTime(e.TenAt)
|
|
||||||
ret.Next = NewOptString(e.Next)
|
ret.Next = NewOptString(e.Next)
|
||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
@@ -307,29 +282,8 @@ func NewGroupUsersList(e *ent.User) *GroupUsersList {
|
|||||||
var ret GroupUsersList
|
var ret GroupUsersList
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Username = e.Username
|
ret.Username = e.Username
|
||||||
ret.Did = NewOptString(e.Did)
|
|
||||||
ret.Bsky = NewOptBool(e.Bsky)
|
|
||||||
ret.Mastodon = NewOptBool(e.Mastodon)
|
|
||||||
ret.Delete = NewOptBool(e.Delete)
|
|
||||||
ret.Handle = NewOptBool(e.Handle)
|
|
||||||
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
||||||
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
||||||
ret.RaidAt = NewOptDateTime(e.RaidAt)
|
|
||||||
ret.Luck = NewOptInt(e.Luck)
|
|
||||||
ret.LuckAt = NewOptDateTime(e.LuckAt)
|
|
||||||
ret.Like = NewOptInt(e.Like)
|
|
||||||
ret.LikeRank = NewOptInt(e.LikeRank)
|
|
||||||
ret.LikeAt = NewOptDateTime(e.LikeAt)
|
|
||||||
ret.Fav = NewOptInt(e.Fav)
|
|
||||||
ret.Ten = NewOptBool(e.Ten)
|
|
||||||
ret.TenSu = NewOptInt(e.TenSu)
|
|
||||||
ret.TenKai = NewOptInt(e.TenKai)
|
|
||||||
ret.Aiten = NewOptInt(e.Aiten)
|
|
||||||
ret.TenCard = NewOptString(e.TenCard)
|
|
||||||
ret.TenDelete = NewOptString(e.TenDelete)
|
|
||||||
ret.TenPost = NewOptString(e.TenPost)
|
|
||||||
ret.TenGet = NewOptString(e.TenGet)
|
|
||||||
ret.TenAt = NewOptDateTime(e.TenAt)
|
|
||||||
ret.Next = NewOptString(e.Next)
|
ret.Next = NewOptString(e.Next)
|
||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
@@ -359,29 +313,8 @@ func NewUserCreate(e *ent.User) *UserCreate {
|
|||||||
var ret UserCreate
|
var ret UserCreate
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Username = e.Username
|
ret.Username = e.Username
|
||||||
ret.Did = NewOptString(e.Did)
|
|
||||||
ret.Bsky = NewOptBool(e.Bsky)
|
|
||||||
ret.Mastodon = NewOptBool(e.Mastodon)
|
|
||||||
ret.Delete = NewOptBool(e.Delete)
|
|
||||||
ret.Handle = NewOptBool(e.Handle)
|
|
||||||
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
||||||
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
||||||
ret.RaidAt = NewOptDateTime(e.RaidAt)
|
|
||||||
ret.Luck = NewOptInt(e.Luck)
|
|
||||||
ret.LuckAt = NewOptDateTime(e.LuckAt)
|
|
||||||
ret.Like = NewOptInt(e.Like)
|
|
||||||
ret.LikeRank = NewOptInt(e.LikeRank)
|
|
||||||
ret.LikeAt = NewOptDateTime(e.LikeAt)
|
|
||||||
ret.Fav = NewOptInt(e.Fav)
|
|
||||||
ret.Ten = NewOptBool(e.Ten)
|
|
||||||
ret.TenSu = NewOptInt(e.TenSu)
|
|
||||||
ret.TenKai = NewOptInt(e.TenKai)
|
|
||||||
ret.Aiten = NewOptInt(e.Aiten)
|
|
||||||
ret.TenCard = NewOptString(e.TenCard)
|
|
||||||
ret.TenDelete = NewOptString(e.TenDelete)
|
|
||||||
ret.TenPost = NewOptString(e.TenPost)
|
|
||||||
ret.TenGet = NewOptString(e.TenGet)
|
|
||||||
ret.TenAt = NewOptDateTime(e.TenAt)
|
|
||||||
ret.Next = NewOptString(e.Next)
|
ret.Next = NewOptString(e.Next)
|
||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
@@ -411,29 +344,8 @@ func NewUserList(e *ent.User) *UserList {
|
|||||||
var ret UserList
|
var ret UserList
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Username = e.Username
|
ret.Username = e.Username
|
||||||
ret.Did = NewOptString(e.Did)
|
|
||||||
ret.Bsky = NewOptBool(e.Bsky)
|
|
||||||
ret.Mastodon = NewOptBool(e.Mastodon)
|
|
||||||
ret.Delete = NewOptBool(e.Delete)
|
|
||||||
ret.Handle = NewOptBool(e.Handle)
|
|
||||||
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
||||||
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
||||||
ret.RaidAt = NewOptDateTime(e.RaidAt)
|
|
||||||
ret.Luck = NewOptInt(e.Luck)
|
|
||||||
ret.LuckAt = NewOptDateTime(e.LuckAt)
|
|
||||||
ret.Like = NewOptInt(e.Like)
|
|
||||||
ret.LikeRank = NewOptInt(e.LikeRank)
|
|
||||||
ret.LikeAt = NewOptDateTime(e.LikeAt)
|
|
||||||
ret.Fav = NewOptInt(e.Fav)
|
|
||||||
ret.Ten = NewOptBool(e.Ten)
|
|
||||||
ret.TenSu = NewOptInt(e.TenSu)
|
|
||||||
ret.TenKai = NewOptInt(e.TenKai)
|
|
||||||
ret.Aiten = NewOptInt(e.Aiten)
|
|
||||||
ret.TenCard = NewOptString(e.TenCard)
|
|
||||||
ret.TenDelete = NewOptString(e.TenDelete)
|
|
||||||
ret.TenPost = NewOptString(e.TenPost)
|
|
||||||
ret.TenGet = NewOptString(e.TenGet)
|
|
||||||
ret.TenAt = NewOptDateTime(e.TenAt)
|
|
||||||
ret.Next = NewOptString(e.Next)
|
ret.Next = NewOptString(e.Next)
|
||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
@@ -463,29 +375,8 @@ func NewUserRead(e *ent.User) *UserRead {
|
|||||||
var ret UserRead
|
var ret UserRead
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Username = e.Username
|
ret.Username = e.Username
|
||||||
ret.Did = NewOptString(e.Did)
|
|
||||||
ret.Bsky = NewOptBool(e.Bsky)
|
|
||||||
ret.Mastodon = NewOptBool(e.Mastodon)
|
|
||||||
ret.Delete = NewOptBool(e.Delete)
|
|
||||||
ret.Handle = NewOptBool(e.Handle)
|
|
||||||
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
||||||
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
||||||
ret.RaidAt = NewOptDateTime(e.RaidAt)
|
|
||||||
ret.Luck = NewOptInt(e.Luck)
|
|
||||||
ret.LuckAt = NewOptDateTime(e.LuckAt)
|
|
||||||
ret.Like = NewOptInt(e.Like)
|
|
||||||
ret.LikeRank = NewOptInt(e.LikeRank)
|
|
||||||
ret.LikeAt = NewOptDateTime(e.LikeAt)
|
|
||||||
ret.Fav = NewOptInt(e.Fav)
|
|
||||||
ret.Ten = NewOptBool(e.Ten)
|
|
||||||
ret.TenSu = NewOptInt(e.TenSu)
|
|
||||||
ret.TenKai = NewOptInt(e.TenKai)
|
|
||||||
ret.Aiten = NewOptInt(e.Aiten)
|
|
||||||
ret.TenCard = NewOptString(e.TenCard)
|
|
||||||
ret.TenDelete = NewOptString(e.TenDelete)
|
|
||||||
ret.TenPost = NewOptString(e.TenPost)
|
|
||||||
ret.TenGet = NewOptString(e.TenGet)
|
|
||||||
ret.TenAt = NewOptDateTime(e.TenAt)
|
|
||||||
ret.Next = NewOptString(e.Next)
|
ret.Next = NewOptString(e.Next)
|
||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
@@ -515,29 +406,8 @@ func NewUserUpdate(e *ent.User) *UserUpdate {
|
|||||||
var ret UserUpdate
|
var ret UserUpdate
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Username = e.Username
|
ret.Username = e.Username
|
||||||
ret.Did = NewOptString(e.Did)
|
|
||||||
ret.Bsky = NewOptBool(e.Bsky)
|
|
||||||
ret.Mastodon = NewOptBool(e.Mastodon)
|
|
||||||
ret.Delete = NewOptBool(e.Delete)
|
|
||||||
ret.Handle = NewOptBool(e.Handle)
|
|
||||||
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
ret.CreatedAt = NewOptDateTime(e.CreatedAt)
|
||||||
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
ret.UpdatedAt = NewOptDateTime(e.UpdatedAt)
|
||||||
ret.RaidAt = NewOptDateTime(e.RaidAt)
|
|
||||||
ret.Luck = NewOptInt(e.Luck)
|
|
||||||
ret.LuckAt = NewOptDateTime(e.LuckAt)
|
|
||||||
ret.Like = NewOptInt(e.Like)
|
|
||||||
ret.LikeRank = NewOptInt(e.LikeRank)
|
|
||||||
ret.LikeAt = NewOptDateTime(e.LikeAt)
|
|
||||||
ret.Fav = NewOptInt(e.Fav)
|
|
||||||
ret.Ten = NewOptBool(e.Ten)
|
|
||||||
ret.TenSu = NewOptInt(e.TenSu)
|
|
||||||
ret.TenKai = NewOptInt(e.TenKai)
|
|
||||||
ret.Aiten = NewOptInt(e.Aiten)
|
|
||||||
ret.TenCard = NewOptString(e.TenCard)
|
|
||||||
ret.TenDelete = NewOptString(e.TenDelete)
|
|
||||||
ret.TenPost = NewOptString(e.TenPost)
|
|
||||||
ret.TenGet = NewOptString(e.TenGet)
|
|
||||||
ret.TenAt = NewOptDateTime(e.TenAt)
|
|
||||||
ret.Next = NewOptString(e.Next)
|
ret.Next = NewOptString(e.Next)
|
||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
@@ -567,7 +437,6 @@ func NewUserCardList(e *ent.Card) *UserCardList {
|
|||||||
var ret UserCardList
|
var ret UserCardList
|
||||||
ret.ID = e.ID
|
ret.ID = e.ID
|
||||||
ret.Card = NewOptInt(e.Card)
|
ret.Card = NewOptInt(e.Card)
|
||||||
ret.Skill = NewOptString(e.Skill)
|
|
||||||
ret.Status = NewOptString(e.Status)
|
ret.Status = NewOptString(e.Status)
|
||||||
ret.Cp = NewOptInt(e.Cp)
|
ret.Cp = NewOptInt(e.Cp)
|
||||||
ret.URL = NewOptString(e.URL)
|
ret.URL = NewOptString(e.URL)
|
||||||
|
689
ent/openapi.json
689
ent/openapi.json
@@ -30,7 +30,7 @@
|
|||||||
"description": "item count to render per page",
|
"description": "item count to render per page",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"maximum": 4000,
|
"maximum": 255,
|
||||||
"minimum": 1
|
"minimum": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,21 +77,12 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"card": {
|
"card": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"token": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"cp": {
|
"cp": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
@@ -107,7 +98,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"password",
|
|
||||||
"owner"
|
"owner"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -243,18 +233,6 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"token": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"cp": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"owner": {
|
"owner": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
}
|
}
|
||||||
@@ -384,7 +362,7 @@
|
|||||||
"description": "item count to render per page",
|
"description": "item count to render per page",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"maximum": 4000,
|
"maximum": 255,
|
||||||
"minimum": 1
|
"minimum": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -434,9 +412,6 @@
|
|||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"users": {
|
"users": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@@ -445,8 +420,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"name",
|
"name"
|
||||||
"password"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -710,7 +684,7 @@
|
|||||||
"description": "item count to render per page",
|
"description": "item count to render per page",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"maximum": 4000,
|
"maximum": 255,
|
||||||
"minimum": 1
|
"minimum": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -760,27 +734,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"token": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -789,58 +742,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -852,8 +753,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"username",
|
"username"
|
||||||
"password"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -988,80 +888,10 @@
|
|||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"token": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"updated_at": {
|
"updated_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -1201,21 +1031,12 @@
|
|||||||
"id": {
|
"id": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"card": {
|
"card": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"token": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"cp": {
|
"cp": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
@@ -1232,7 +1053,6 @@
|
|||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
"password",
|
|
||||||
"owner"
|
"owner"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -1245,9 +1065,6 @@
|
|||||||
"card": {
|
"card": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -1275,9 +1092,6 @@
|
|||||||
"card": {
|
"card": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -1305,9 +1119,6 @@
|
|||||||
"card": {
|
"card": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -1335,9 +1146,6 @@
|
|||||||
"card": {
|
"card": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -1365,21 +1173,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -1388,58 +1181,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -1458,9 +1199,6 @@
|
|||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"users": {
|
"users": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@@ -1470,8 +1208,7 @@
|
|||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name"
|
||||||
"password"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"GroupCreate": {
|
"GroupCreate": {
|
||||||
@@ -1543,21 +1280,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -1566,58 +1288,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -1636,27 +1306,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"token": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -1665,58 +1314,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -1729,8 +1326,7 @@
|
|||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"id",
|
"id",
|
||||||
"username",
|
"username"
|
||||||
"password"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"UserCreate": {
|
"UserCreate": {
|
||||||
@@ -1742,21 +1338,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -1765,58 +1346,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -1835,21 +1364,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -1858,58 +1372,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -1928,21 +1390,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -1951,58 +1398,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -2021,21 +1416,6 @@
|
|||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"did": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"bsky": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"mastodon": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"delete": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"handle": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"created_at": {
|
"created_at": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
@@ -2044,58 +1424,6 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
},
|
},
|
||||||
"raid_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"luck": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"luck_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"like": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_rank": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"like_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"fav": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"ten_su": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_kai": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"aiten": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"ten_card": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_delete": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_post": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_get": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"ten_at": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"next": {
|
"next": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -2114,9 +1442,6 @@
|
|||||||
"card": {
|
"card": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"skill": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
"status": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@@ -4,7 +4,6 @@ package ent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"t/ent/card"
|
"t/ent/card"
|
||||||
"t/ent/group"
|
|
||||||
"t/ent/schema"
|
"t/ent/schema"
|
||||||
"t/ent/user"
|
"t/ent/user"
|
||||||
"time"
|
"time"
|
||||||
@@ -16,40 +15,26 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
cardFields := schema.Card{}.Fields()
|
cardFields := schema.Card{}.Fields()
|
||||||
_ = cardFields
|
_ = cardFields
|
||||||
// cardDescPassword is the schema descriptor for password field.
|
|
||||||
cardDescPassword := cardFields[0].Descriptor()
|
|
||||||
// card.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
||||||
card.PasswordValidator = cardDescPassword.Validators[0].(func(string) error)
|
|
||||||
// cardDescCard is the schema descriptor for card field.
|
// cardDescCard is the schema descriptor for card field.
|
||||||
cardDescCard := cardFields[1].Descriptor()
|
cardDescCard := cardFields[0].Descriptor()
|
||||||
// card.DefaultCard holds the default value on creation for the card field.
|
// card.DefaultCard holds the default value on creation for the card field.
|
||||||
card.DefaultCard = cardDescCard.Default.(func() int)
|
card.DefaultCard = cardDescCard.Default.(func() int)
|
||||||
// cardDescSkill is the schema descriptor for skill field.
|
|
||||||
cardDescSkill := cardFields[2].Descriptor()
|
|
||||||
// card.DefaultSkill holds the default value on creation for the skill field.
|
|
||||||
card.DefaultSkill = cardDescSkill.Default.(func() string)
|
|
||||||
// cardDescStatus is the schema descriptor for status field.
|
// cardDescStatus is the schema descriptor for status field.
|
||||||
cardDescStatus := cardFields[3].Descriptor()
|
cardDescStatus := cardFields[1].Descriptor()
|
||||||
// card.DefaultStatus holds the default value on creation for the status field.
|
// card.DefaultStatus holds the default value on creation for the status field.
|
||||||
card.DefaultStatus = cardDescStatus.Default.(func() string)
|
card.DefaultStatus = cardDescStatus.Default.(func() string)
|
||||||
// cardDescCp is the schema descriptor for cp field.
|
// cardDescCp is the schema descriptor for cp field.
|
||||||
cardDescCp := cardFields[5].Descriptor()
|
cardDescCp := cardFields[2].Descriptor()
|
||||||
// card.DefaultCp holds the default value on creation for the cp field.
|
// card.DefaultCp holds the default value on creation for the cp field.
|
||||||
card.DefaultCp = cardDescCp.Default.(func() int)
|
card.DefaultCp = cardDescCp.Default.(func() int)
|
||||||
// cardDescURL is the schema descriptor for url field.
|
// cardDescURL is the schema descriptor for url field.
|
||||||
cardDescURL := cardFields[6].Descriptor()
|
cardDescURL := cardFields[3].Descriptor()
|
||||||
// card.DefaultURL holds the default value on creation for the url field.
|
// card.DefaultURL holds the default value on creation for the url field.
|
||||||
card.DefaultURL = cardDescURL.Default.(string)
|
card.DefaultURL = cardDescURL.Default.(string)
|
||||||
// cardDescCreatedAt is the schema descriptor for created_at field.
|
// cardDescCreatedAt is the schema descriptor for created_at field.
|
||||||
cardDescCreatedAt := cardFields[7].Descriptor()
|
cardDescCreatedAt := cardFields[4].Descriptor()
|
||||||
// card.DefaultCreatedAt holds the default value on creation for the created_at field.
|
// card.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||||
card.DefaultCreatedAt = cardDescCreatedAt.Default.(func() time.Time)
|
card.DefaultCreatedAt = cardDescCreatedAt.Default.(func() time.Time)
|
||||||
groupFields := schema.Group{}.Fields()
|
|
||||||
_ = groupFields
|
|
||||||
// groupDescPassword is the schema descriptor for password field.
|
|
||||||
groupDescPassword := groupFields[1].Descriptor()
|
|
||||||
// group.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
||||||
group.PasswordValidator = groupDescPassword.Validators[0].(func(string) error)
|
|
||||||
userFields := schema.User{}.Fields()
|
userFields := schema.User{}.Fields()
|
||||||
_ = userFields
|
_ = userFields
|
||||||
// userDescUsername is the schema descriptor for username field.
|
// userDescUsername is the schema descriptor for username field.
|
||||||
@@ -70,52 +55,16 @@ func init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// userDescBsky is the schema descriptor for bsky field.
|
|
||||||
userDescBsky := userFields[2].Descriptor()
|
|
||||||
// user.DefaultBsky holds the default value on creation for the bsky field.
|
|
||||||
user.DefaultBsky = userDescBsky.Default.(bool)
|
|
||||||
// userDescMastodon is the schema descriptor for mastodon field.
|
|
||||||
userDescMastodon := userFields[3].Descriptor()
|
|
||||||
// user.DefaultMastodon holds the default value on creation for the mastodon field.
|
|
||||||
user.DefaultMastodon = userDescMastodon.Default.(bool)
|
|
||||||
// userDescDelete is the schema descriptor for delete field.
|
|
||||||
userDescDelete := userFields[4].Descriptor()
|
|
||||||
// user.DefaultDelete holds the default value on creation for the delete field.
|
|
||||||
user.DefaultDelete = userDescDelete.Default.(bool)
|
|
||||||
// userDescHandle is the schema descriptor for handle field.
|
|
||||||
userDescHandle := userFields[5].Descriptor()
|
|
||||||
// user.DefaultHandle holds the default value on creation for the handle field.
|
|
||||||
user.DefaultHandle = userDescHandle.Default.(bool)
|
|
||||||
// userDescPassword is the schema descriptor for password field.
|
|
||||||
userDescPassword := userFields[7].Descriptor()
|
|
||||||
// user.PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
||||||
user.PasswordValidator = userDescPassword.Validators[0].(func(string) error)
|
|
||||||
// userDescCreatedAt is the schema descriptor for created_at field.
|
// userDescCreatedAt is the schema descriptor for created_at field.
|
||||||
userDescCreatedAt := userFields[8].Descriptor()
|
userDescCreatedAt := userFields[1].Descriptor()
|
||||||
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
|
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||||
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
|
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
|
||||||
// userDescUpdatedAt is the schema descriptor for updated_at field.
|
// userDescUpdatedAt is the schema descriptor for updated_at field.
|
||||||
userDescUpdatedAt := userFields[9].Descriptor()
|
userDescUpdatedAt := userFields[2].Descriptor()
|
||||||
// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||||
user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)
|
user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)
|
||||||
// userDescRaidAt is the schema descriptor for raid_at field.
|
|
||||||
userDescRaidAt := userFields[10].Descriptor()
|
|
||||||
// user.DefaultRaidAt holds the default value on creation for the raid_at field.
|
|
||||||
user.DefaultRaidAt = userDescRaidAt.Default.(func() time.Time)
|
|
||||||
// userDescLuckAt is the schema descriptor for luck_at field.
|
|
||||||
userDescLuckAt := userFields[12].Descriptor()
|
|
||||||
// user.DefaultLuckAt holds the default value on creation for the luck_at field.
|
|
||||||
user.DefaultLuckAt = userDescLuckAt.Default.(func() time.Time)
|
|
||||||
// userDescLikeAt is the schema descriptor for like_at field.
|
|
||||||
userDescLikeAt := userFields[15].Descriptor()
|
|
||||||
// user.DefaultLikeAt holds the default value on creation for the like_at field.
|
|
||||||
user.DefaultLikeAt = userDescLikeAt.Default.(func() time.Time)
|
|
||||||
// userDescTenAt is the schema descriptor for ten_at field.
|
|
||||||
userDescTenAt := userFields[25].Descriptor()
|
|
||||||
// user.DefaultTenAt holds the default value on creation for the ten_at field.
|
|
||||||
user.DefaultTenAt = userDescTenAt.Default.(func() time.Time)
|
|
||||||
// userDescNext is the schema descriptor for next field.
|
// userDescNext is the schema descriptor for next field.
|
||||||
userDescNext := userFields[26].Descriptor()
|
userDescNext := userFields[3].Descriptor()
|
||||||
// user.DefaultNext holds the default value on creation for the next field.
|
// user.DefaultNext holds the default value on creation for the next field.
|
||||||
user.DefaultNext = userDescNext.Default.(string)
|
user.DefaultNext = userDescNext.Default.(string)
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,6 @@ package runtime
|
|||||||
// The schema-stitching logic is generated in t/ent/runtime.go
|
// The schema-stitching logic is generated in t/ent/runtime.go
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "v0.11.10" // Version of ent codegen.
|
Version = "v0.11.9" // Version of ent codegen.
|
||||||
Sum = "h1:iqn32ybY5HRW3xSAyMNdNKpZhKgMf1Zunsej9yPKUI8=" // Sum of ent codegen.
|
Sum = "h1:dbbCkAiPVTRBIJwoZctiSYjB7zxQIBOzVSU5H9VYIQI=" // Sum of ent codegen.
|
||||||
)
|
)
|
||||||
|
@@ -16,71 +16,29 @@ var url = "https://card.syui.ai"
|
|||||||
|
|
||||||
var card int
|
var card int
|
||||||
var super string
|
var super string
|
||||||
var skill string
|
|
||||||
var cp int
|
var cp int
|
||||||
|
|
||||||
func (Card) Fields() []ent.Field {
|
func (Card) Fields() []ent.Field {
|
||||||
return []ent.Field{
|
return []ent.Field{
|
||||||
|
|
||||||
field.String("password").
|
|
||||||
NotEmpty().
|
|
||||||
Immutable().
|
|
||||||
Sensitive(),
|
|
||||||
|
|
||||||
field.Int("card").
|
field.Int("card").
|
||||||
Immutable().
|
Immutable().
|
||||||
DefaultFunc(func() int {
|
DefaultFunc(func() int {
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
var a = rand.Intn(10)
|
var a = rand.Intn(10)
|
||||||
if a == 1 {
|
if a == 1 {
|
||||||
card = rand.Intn(16)
|
card = rand.Intn(15)
|
||||||
} else {
|
} else {
|
||||||
card = 0
|
card = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if card == 13 {
|
if card == 13 {
|
||||||
card = 2
|
card = 14
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2023/04/09 premium card id:15
|
|
||||||
if card == 15 {
|
|
||||||
card = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
if card == 16 {
|
|
||||||
card = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
if card == 17 {
|
|
||||||
card = 5
|
|
||||||
}
|
|
||||||
|
|
||||||
if card == 18 {
|
|
||||||
card = 6
|
|
||||||
}
|
|
||||||
|
|
||||||
return card
|
return card
|
||||||
}).
|
}).
|
||||||
Optional(),
|
Optional(),
|
||||||
|
|
||||||
field.String("skill").
|
|
||||||
DefaultFunc(func() string {
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
var a = rand.Intn(12)
|
|
||||||
if a == 1 {
|
|
||||||
skill = "critical"
|
|
||||||
} else {
|
|
||||||
skill = "normal"
|
|
||||||
}
|
|
||||||
if card == 0 {
|
|
||||||
skill = "normal"
|
|
||||||
}
|
|
||||||
return skill
|
|
||||||
}).
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.String("status").
|
field.String("status").
|
||||||
//Immutable().
|
Immutable().
|
||||||
DefaultFunc(func() string {
|
DefaultFunc(func() string {
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
var a = rand.Intn(10)
|
var a = rand.Intn(10)
|
||||||
@@ -96,35 +54,19 @@ func (Card) Fields() []ent.Field {
|
|||||||
}).
|
}).
|
||||||
Optional(),
|
Optional(),
|
||||||
|
|
||||||
field.String("token").
|
|
||||||
Optional().
|
|
||||||
Sensitive(),
|
|
||||||
|
|
||||||
field.Int("cp").
|
field.Int("cp").
|
||||||
//Immutable().
|
Immutable().
|
||||||
DefaultFunc(func() int {
|
DefaultFunc(func() int {
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
var cp = 1 + rand.Intn(100)
|
var cp = rand.Intn(100)
|
||||||
if cp == 2 {
|
if cp == 1 {
|
||||||
cp = 50 + rand.Intn(150)
|
cp = rand.Intn(250)
|
||||||
}
|
}
|
||||||
if card >= 1 {
|
if card > 1 {
|
||||||
cp = 150 + cp + rand.Intn(300)
|
cp = cp + rand.Intn(250)
|
||||||
}
|
}
|
||||||
if super == "super" {
|
if super == "super" {
|
||||||
cp = 300 + cp + rand.Intn(500)
|
cp = cp + rand.Intn(500)
|
||||||
}
|
|
||||||
|
|
||||||
if skill == "critical" {
|
|
||||||
cp = 300 + cp + rand.Intn(500)
|
|
||||||
}
|
|
||||||
|
|
||||||
if card == 22 {
|
|
||||||
cp = 800 + cp + rand.Intn(1500)
|
|
||||||
}
|
|
||||||
|
|
||||||
if card == 25 {
|
|
||||||
cp = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp
|
return cp
|
||||||
@@ -151,6 +93,5 @@ func (Card) Edges() []ent.Edge {
|
|||||||
Ref("card").
|
Ref("card").
|
||||||
Unique().
|
Unique().
|
||||||
Required(),
|
Required(),
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,11 +16,6 @@ type Group struct {
|
|||||||
func (Group) Fields() []ent.Field {
|
func (Group) Fields() []ent.Field {
|
||||||
return []ent.Field{
|
return []ent.Field{
|
||||||
field.String("name"),
|
field.String("name"),
|
||||||
|
|
||||||
field.String("password").
|
|
||||||
NotEmpty().
|
|
||||||
Immutable().
|
|
||||||
Sensitive(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,37 +31,13 @@ func (User) Fields() []ent.Field {
|
|||||||
field.String("username").
|
field.String("username").
|
||||||
NotEmpty().
|
NotEmpty().
|
||||||
Immutable().
|
Immutable().
|
||||||
MaxLen(100).
|
MaxLen(30).
|
||||||
//Match(regexp.MustCompile("[a-z]+$")).
|
//Match(regexp.MustCompile("[a-z]+$")).
|
||||||
Unique(),
|
Unique(),
|
||||||
|
|
||||||
field.String("did").
|
//field.Bool("limit").
|
||||||
Optional(),
|
//Optional().
|
||||||
|
//Default(false),
|
||||||
field.Bool("bsky").
|
|
||||||
Default(false).
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Bool("mastodon").
|
|
||||||
Default(true).
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Bool("delete").
|
|
||||||
Default(false).
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Bool("handle").
|
|
||||||
Default(false).
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.String("token").
|
|
||||||
Optional().
|
|
||||||
Sensitive(),
|
|
||||||
|
|
||||||
field.String("password").
|
|
||||||
NotEmpty().
|
|
||||||
Immutable().
|
|
||||||
Sensitive(),
|
|
||||||
|
|
||||||
field.Time("created_at").
|
field.Time("created_at").
|
||||||
Immutable().
|
Immutable().
|
||||||
@@ -76,66 +52,6 @@ func (User) Fields() []ent.Field {
|
|||||||
return time.Now().In(jst)
|
return time.Now().In(jst)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
field.Time("raid_at").
|
|
||||||
Optional().
|
|
||||||
Default(func() time.Time {
|
|
||||||
return time.Now().In(jst)
|
|
||||||
}),
|
|
||||||
|
|
||||||
field.Int("luck").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Time("luck_at").
|
|
||||||
Optional().
|
|
||||||
Default(func() time.Time {
|
|
||||||
return time.Now().In(jst)
|
|
||||||
}),
|
|
||||||
|
|
||||||
field.Int("like").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Int("like_rank").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Time("like_at").
|
|
||||||
Optional().
|
|
||||||
Default(func() time.Time {
|
|
||||||
return time.Now().In(jst)
|
|
||||||
}),
|
|
||||||
|
|
||||||
field.Int("fav").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Bool("ten").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Int("ten_su").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Int("ten_kai").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Int("aiten").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.String("ten_card").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.String("ten_delete").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.String("ten_post").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.String("ten_get").
|
|
||||||
Optional(),
|
|
||||||
|
|
||||||
field.Time("ten_at").
|
|
||||||
Optional().
|
|
||||||
Default(func() time.Time {
|
|
||||||
return time.Now().In(jst)
|
|
||||||
}),
|
|
||||||
|
|
||||||
field.String("next").
|
field.String("next").
|
||||||
Default(Nextime()).
|
Default(Nextime()).
|
||||||
Optional(),
|
Optional(),
|
||||||
|
259
ent/user.go
259
ent/user.go
@@ -18,56 +18,10 @@ type User struct {
|
|||||||
ID int `json:"id,omitempty"`
|
ID int `json:"id,omitempty"`
|
||||||
// Username holds the value of the "username" field.
|
// Username holds the value of the "username" field.
|
||||||
Username string `json:"username,omitempty"`
|
Username string `json:"username,omitempty"`
|
||||||
// Did holds the value of the "did" field.
|
|
||||||
Did string `json:"did,omitempty"`
|
|
||||||
// Bsky holds the value of the "bsky" field.
|
|
||||||
Bsky bool `json:"bsky,omitempty"`
|
|
||||||
// Mastodon holds the value of the "mastodon" field.
|
|
||||||
Mastodon bool `json:"mastodon,omitempty"`
|
|
||||||
// Delete holds the value of the "delete" field.
|
|
||||||
Delete bool `json:"delete,omitempty"`
|
|
||||||
// Handle holds the value of the "handle" field.
|
|
||||||
Handle bool `json:"handle,omitempty"`
|
|
||||||
// Token holds the value of the "token" field.
|
|
||||||
Token string `json:"-"`
|
|
||||||
// Password holds the value of the "password" field.
|
|
||||||
Password string `json:"-"`
|
|
||||||
// CreatedAt holds the value of the "created_at" field.
|
// CreatedAt holds the value of the "created_at" field.
|
||||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
// UpdatedAt holds the value of the "updated_at" field.
|
// UpdatedAt holds the value of the "updated_at" field.
|
||||||
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||||
// RaidAt holds the value of the "raid_at" field.
|
|
||||||
RaidAt time.Time `json:"raid_at,omitempty"`
|
|
||||||
// Luck holds the value of the "luck" field.
|
|
||||||
Luck int `json:"luck,omitempty"`
|
|
||||||
// LuckAt holds the value of the "luck_at" field.
|
|
||||||
LuckAt time.Time `json:"luck_at,omitempty"`
|
|
||||||
// Like holds the value of the "like" field.
|
|
||||||
Like int `json:"like,omitempty"`
|
|
||||||
// LikeRank holds the value of the "like_rank" field.
|
|
||||||
LikeRank int `json:"like_rank,omitempty"`
|
|
||||||
// LikeAt holds the value of the "like_at" field.
|
|
||||||
LikeAt time.Time `json:"like_at,omitempty"`
|
|
||||||
// Fav holds the value of the "fav" field.
|
|
||||||
Fav int `json:"fav,omitempty"`
|
|
||||||
// Ten holds the value of the "ten" field.
|
|
||||||
Ten bool `json:"ten,omitempty"`
|
|
||||||
// TenSu holds the value of the "ten_su" field.
|
|
||||||
TenSu int `json:"ten_su,omitempty"`
|
|
||||||
// TenKai holds the value of the "ten_kai" field.
|
|
||||||
TenKai int `json:"ten_kai,omitempty"`
|
|
||||||
// Aiten holds the value of the "aiten" field.
|
|
||||||
Aiten int `json:"aiten,omitempty"`
|
|
||||||
// TenCard holds the value of the "ten_card" field.
|
|
||||||
TenCard string `json:"ten_card,omitempty"`
|
|
||||||
// TenDelete holds the value of the "ten_delete" field.
|
|
||||||
TenDelete string `json:"ten_delete,omitempty"`
|
|
||||||
// TenPost holds the value of the "ten_post" field.
|
|
||||||
TenPost string `json:"ten_post,omitempty"`
|
|
||||||
// TenGet holds the value of the "ten_get" field.
|
|
||||||
TenGet string `json:"ten_get,omitempty"`
|
|
||||||
// TenAt holds the value of the "ten_at" field.
|
|
||||||
TenAt time.Time `json:"ten_at,omitempty"`
|
|
||||||
// Next holds the value of the "next" field.
|
// Next holds the value of the "next" field.
|
||||||
Next string `json:"next,omitempty"`
|
Next string `json:"next,omitempty"`
|
||||||
// Edges holds the relations/edges for other nodes in the graph.
|
// Edges holds the relations/edges for other nodes in the graph.
|
||||||
@@ -99,13 +53,11 @@ func (*User) scanValues(columns []string) ([]any, error) {
|
|||||||
values := make([]any, len(columns))
|
values := make([]any, len(columns))
|
||||||
for i := range columns {
|
for i := range columns {
|
||||||
switch columns[i] {
|
switch columns[i] {
|
||||||
case user.FieldBsky, user.FieldMastodon, user.FieldDelete, user.FieldHandle, user.FieldTen:
|
case user.FieldID:
|
||||||
values[i] = new(sql.NullBool)
|
|
||||||
case user.FieldID, user.FieldLuck, user.FieldLike, user.FieldLikeRank, user.FieldFav, user.FieldTenSu, user.FieldTenKai, user.FieldAiten:
|
|
||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case user.FieldUsername, user.FieldDid, user.FieldToken, user.FieldPassword, user.FieldTenCard, user.FieldTenDelete, user.FieldTenPost, user.FieldTenGet, user.FieldNext:
|
case user.FieldUsername, user.FieldNext:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldRaidAt, user.FieldLuckAt, user.FieldLikeAt, user.FieldTenAt:
|
case user.FieldCreatedAt, user.FieldUpdatedAt:
|
||||||
values[i] = new(sql.NullTime)
|
values[i] = new(sql.NullTime)
|
||||||
case user.ForeignKeys[0]: // group_users
|
case user.ForeignKeys[0]: // group_users
|
||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
@@ -136,48 +88,6 @@ func (u *User) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
u.Username = value.String
|
u.Username = value.String
|
||||||
}
|
}
|
||||||
case user.FieldDid:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field did", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Did = value.String
|
|
||||||
}
|
|
||||||
case user.FieldBsky:
|
|
||||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field bsky", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Bsky = value.Bool
|
|
||||||
}
|
|
||||||
case user.FieldMastodon:
|
|
||||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field mastodon", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Mastodon = value.Bool
|
|
||||||
}
|
|
||||||
case user.FieldDelete:
|
|
||||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field delete", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Delete = value.Bool
|
|
||||||
}
|
|
||||||
case user.FieldHandle:
|
|
||||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field handle", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Handle = value.Bool
|
|
||||||
}
|
|
||||||
case user.FieldToken:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field token", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Token = value.String
|
|
||||||
}
|
|
||||||
case user.FieldPassword:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field password", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Password = value.String
|
|
||||||
}
|
|
||||||
case user.FieldCreatedAt:
|
case user.FieldCreatedAt:
|
||||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||||
@@ -190,102 +100,6 @@ func (u *User) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
u.UpdatedAt = value.Time
|
u.UpdatedAt = value.Time
|
||||||
}
|
}
|
||||||
case user.FieldRaidAt:
|
|
||||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field raid_at", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.RaidAt = value.Time
|
|
||||||
}
|
|
||||||
case user.FieldLuck:
|
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field luck", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Luck = int(value.Int64)
|
|
||||||
}
|
|
||||||
case user.FieldLuckAt:
|
|
||||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field luck_at", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.LuckAt = value.Time
|
|
||||||
}
|
|
||||||
case user.FieldLike:
|
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field like", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Like = int(value.Int64)
|
|
||||||
}
|
|
||||||
case user.FieldLikeRank:
|
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field like_rank", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.LikeRank = int(value.Int64)
|
|
||||||
}
|
|
||||||
case user.FieldLikeAt:
|
|
||||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field like_at", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.LikeAt = value.Time
|
|
||||||
}
|
|
||||||
case user.FieldFav:
|
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field fav", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Fav = int(value.Int64)
|
|
||||||
}
|
|
||||||
case user.FieldTen:
|
|
||||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Ten = value.Bool
|
|
||||||
}
|
|
||||||
case user.FieldTenSu:
|
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten_su", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.TenSu = int(value.Int64)
|
|
||||||
}
|
|
||||||
case user.FieldTenKai:
|
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten_kai", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.TenKai = int(value.Int64)
|
|
||||||
}
|
|
||||||
case user.FieldAiten:
|
|
||||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field aiten", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.Aiten = int(value.Int64)
|
|
||||||
}
|
|
||||||
case user.FieldTenCard:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten_card", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.TenCard = value.String
|
|
||||||
}
|
|
||||||
case user.FieldTenDelete:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten_delete", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.TenDelete = value.String
|
|
||||||
}
|
|
||||||
case user.FieldTenPost:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten_post", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.TenPost = value.String
|
|
||||||
}
|
|
||||||
case user.FieldTenGet:
|
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten_get", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.TenGet = value.String
|
|
||||||
}
|
|
||||||
case user.FieldTenAt:
|
|
||||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
||||||
return fmt.Errorf("unexpected type %T for field ten_at", values[i])
|
|
||||||
} else if value.Valid {
|
|
||||||
u.TenAt = value.Time
|
|
||||||
}
|
|
||||||
case user.FieldNext:
|
case user.FieldNext:
|
||||||
if value, ok := values[i].(*sql.NullString); !ok {
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
return fmt.Errorf("unexpected type %T for field next", values[i])
|
return fmt.Errorf("unexpected type %T for field next", values[i])
|
||||||
@@ -335,79 +149,12 @@ func (u *User) String() string {
|
|||||||
builder.WriteString("username=")
|
builder.WriteString("username=")
|
||||||
builder.WriteString(u.Username)
|
builder.WriteString(u.Username)
|
||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("did=")
|
|
||||||
builder.WriteString(u.Did)
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("bsky=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Bsky))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("mastodon=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Mastodon))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("delete=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Delete))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("handle=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Handle))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("token=<sensitive>")
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("password=<sensitive>")
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("created_at=")
|
builder.WriteString("created_at=")
|
||||||
builder.WriteString(u.CreatedAt.Format(time.ANSIC))
|
builder.WriteString(u.CreatedAt.Format(time.ANSIC))
|
||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("updated_at=")
|
builder.WriteString("updated_at=")
|
||||||
builder.WriteString(u.UpdatedAt.Format(time.ANSIC))
|
builder.WriteString(u.UpdatedAt.Format(time.ANSIC))
|
||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("raid_at=")
|
|
||||||
builder.WriteString(u.RaidAt.Format(time.ANSIC))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("luck=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Luck))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("luck_at=")
|
|
||||||
builder.WriteString(u.LuckAt.Format(time.ANSIC))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("like=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Like))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("like_rank=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.LikeRank))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("like_at=")
|
|
||||||
builder.WriteString(u.LikeAt.Format(time.ANSIC))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("fav=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Fav))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Ten))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten_su=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.TenSu))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten_kai=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.TenKai))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("aiten=")
|
|
||||||
builder.WriteString(fmt.Sprintf("%v", u.Aiten))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten_card=")
|
|
||||||
builder.WriteString(u.TenCard)
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten_delete=")
|
|
||||||
builder.WriteString(u.TenDelete)
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten_post=")
|
|
||||||
builder.WriteString(u.TenPost)
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten_get=")
|
|
||||||
builder.WriteString(u.TenGet)
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("ten_at=")
|
|
||||||
builder.WriteString(u.TenAt.Format(time.ANSIC))
|
|
||||||
builder.WriteString(", ")
|
|
||||||
builder.WriteString("next=")
|
builder.WriteString("next=")
|
||||||
builder.WriteString(u.Next)
|
builder.WriteString(u.Next)
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
|
@@ -13,56 +13,10 @@ const (
|
|||||||
FieldID = "id"
|
FieldID = "id"
|
||||||
// FieldUsername holds the string denoting the username field in the database.
|
// FieldUsername holds the string denoting the username field in the database.
|
||||||
FieldUsername = "username"
|
FieldUsername = "username"
|
||||||
// FieldDid holds the string denoting the did field in the database.
|
|
||||||
FieldDid = "did"
|
|
||||||
// FieldBsky holds the string denoting the bsky field in the database.
|
|
||||||
FieldBsky = "bsky"
|
|
||||||
// FieldMastodon holds the string denoting the mastodon field in the database.
|
|
||||||
FieldMastodon = "mastodon"
|
|
||||||
// FieldDelete holds the string denoting the delete field in the database.
|
|
||||||
FieldDelete = "delete"
|
|
||||||
// FieldHandle holds the string denoting the handle field in the database.
|
|
||||||
FieldHandle = "handle"
|
|
||||||
// FieldToken holds the string denoting the token field in the database.
|
|
||||||
FieldToken = "token"
|
|
||||||
// FieldPassword holds the string denoting the password field in the database.
|
|
||||||
FieldPassword = "password"
|
|
||||||
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||||
FieldCreatedAt = "created_at"
|
FieldCreatedAt = "created_at"
|
||||||
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
||||||
FieldUpdatedAt = "updated_at"
|
FieldUpdatedAt = "updated_at"
|
||||||
// FieldRaidAt holds the string denoting the raid_at field in the database.
|
|
||||||
FieldRaidAt = "raid_at"
|
|
||||||
// FieldLuck holds the string denoting the luck field in the database.
|
|
||||||
FieldLuck = "luck"
|
|
||||||
// FieldLuckAt holds the string denoting the luck_at field in the database.
|
|
||||||
FieldLuckAt = "luck_at"
|
|
||||||
// FieldLike holds the string denoting the like field in the database.
|
|
||||||
FieldLike = "like"
|
|
||||||
// FieldLikeRank holds the string denoting the like_rank field in the database.
|
|
||||||
FieldLikeRank = "like_rank"
|
|
||||||
// FieldLikeAt holds the string denoting the like_at field in the database.
|
|
||||||
FieldLikeAt = "like_at"
|
|
||||||
// FieldFav holds the string denoting the fav field in the database.
|
|
||||||
FieldFav = "fav"
|
|
||||||
// FieldTen holds the string denoting the ten field in the database.
|
|
||||||
FieldTen = "ten"
|
|
||||||
// FieldTenSu holds the string denoting the ten_su field in the database.
|
|
||||||
FieldTenSu = "ten_su"
|
|
||||||
// FieldTenKai holds the string denoting the ten_kai field in the database.
|
|
||||||
FieldTenKai = "ten_kai"
|
|
||||||
// FieldAiten holds the string denoting the aiten field in the database.
|
|
||||||
FieldAiten = "aiten"
|
|
||||||
// FieldTenCard holds the string denoting the ten_card field in the database.
|
|
||||||
FieldTenCard = "ten_card"
|
|
||||||
// FieldTenDelete holds the string denoting the ten_delete field in the database.
|
|
||||||
FieldTenDelete = "ten_delete"
|
|
||||||
// FieldTenPost holds the string denoting the ten_post field in the database.
|
|
||||||
FieldTenPost = "ten_post"
|
|
||||||
// FieldTenGet holds the string denoting the ten_get field in the database.
|
|
||||||
FieldTenGet = "ten_get"
|
|
||||||
// FieldTenAt holds the string denoting the ten_at field in the database.
|
|
||||||
FieldTenAt = "ten_at"
|
|
||||||
// FieldNext holds the string denoting the next field in the database.
|
// FieldNext holds the string denoting the next field in the database.
|
||||||
FieldNext = "next"
|
FieldNext = "next"
|
||||||
// EdgeCard holds the string denoting the card edge name in mutations.
|
// EdgeCard holds the string denoting the card edge name in mutations.
|
||||||
@@ -82,31 +36,8 @@ const (
|
|||||||
var Columns = []string{
|
var Columns = []string{
|
||||||
FieldID,
|
FieldID,
|
||||||
FieldUsername,
|
FieldUsername,
|
||||||
FieldDid,
|
|
||||||
FieldBsky,
|
|
||||||
FieldMastodon,
|
|
||||||
FieldDelete,
|
|
||||||
FieldHandle,
|
|
||||||
FieldToken,
|
|
||||||
FieldPassword,
|
|
||||||
FieldCreatedAt,
|
FieldCreatedAt,
|
||||||
FieldUpdatedAt,
|
FieldUpdatedAt,
|
||||||
FieldRaidAt,
|
|
||||||
FieldLuck,
|
|
||||||
FieldLuckAt,
|
|
||||||
FieldLike,
|
|
||||||
FieldLikeRank,
|
|
||||||
FieldLikeAt,
|
|
||||||
FieldFav,
|
|
||||||
FieldTen,
|
|
||||||
FieldTenSu,
|
|
||||||
FieldTenKai,
|
|
||||||
FieldAiten,
|
|
||||||
FieldTenCard,
|
|
||||||
FieldTenDelete,
|
|
||||||
FieldTenPost,
|
|
||||||
FieldTenGet,
|
|
||||||
FieldTenAt,
|
|
||||||
FieldNext,
|
FieldNext,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,28 +65,10 @@ func ValidColumn(column string) bool {
|
|||||||
var (
|
var (
|
||||||
// UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
// UsernameValidator is a validator for the "username" field. It is called by the builders before save.
|
||||||
UsernameValidator func(string) error
|
UsernameValidator func(string) error
|
||||||
// DefaultBsky holds the default value on creation for the "bsky" field.
|
|
||||||
DefaultBsky bool
|
|
||||||
// DefaultMastodon holds the default value on creation for the "mastodon" field.
|
|
||||||
DefaultMastodon bool
|
|
||||||
// DefaultDelete holds the default value on creation for the "delete" field.
|
|
||||||
DefaultDelete bool
|
|
||||||
// DefaultHandle holds the default value on creation for the "handle" field.
|
|
||||||
DefaultHandle bool
|
|
||||||
// PasswordValidator is a validator for the "password" field. It is called by the builders before save.
|
|
||||||
PasswordValidator func(string) error
|
|
||||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||||
DefaultCreatedAt func() time.Time
|
DefaultCreatedAt func() time.Time
|
||||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||||
DefaultUpdatedAt func() time.Time
|
DefaultUpdatedAt func() time.Time
|
||||||
// DefaultRaidAt holds the default value on creation for the "raid_at" field.
|
|
||||||
DefaultRaidAt func() time.Time
|
|
||||||
// DefaultLuckAt holds the default value on creation for the "luck_at" field.
|
|
||||||
DefaultLuckAt func() time.Time
|
|
||||||
// DefaultLikeAt holds the default value on creation for the "like_at" field.
|
|
||||||
DefaultLikeAt func() time.Time
|
|
||||||
// DefaultTenAt holds the default value on creation for the "ten_at" field.
|
|
||||||
DefaultTenAt func() time.Time
|
|
||||||
// DefaultNext holds the default value on creation for the "next" field.
|
// DefaultNext holds the default value on creation for the "next" field.
|
||||||
DefaultNext string
|
DefaultNext string
|
||||||
)
|
)
|
||||||
|
1280
ent/user/where.go
1280
ent/user/where.go
File diff suppressed because it is too large
Load Diff
@@ -27,96 +27,6 @@ func (uc *UserCreate) SetUsername(s string) *UserCreate {
|
|||||||
return uc
|
return uc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDid sets the "did" field.
|
|
||||||
func (uc *UserCreate) SetDid(s string) *UserCreate {
|
|
||||||
uc.mutation.SetDid(s)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableDid sets the "did" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableDid(s *string) *UserCreate {
|
|
||||||
if s != nil {
|
|
||||||
uc.SetDid(*s)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetBsky sets the "bsky" field.
|
|
||||||
func (uc *UserCreate) SetBsky(b bool) *UserCreate {
|
|
||||||
uc.mutation.SetBsky(b)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableBsky sets the "bsky" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableBsky(b *bool) *UserCreate {
|
|
||||||
if b != nil {
|
|
||||||
uc.SetBsky(*b)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetMastodon sets the "mastodon" field.
|
|
||||||
func (uc *UserCreate) SetMastodon(b bool) *UserCreate {
|
|
||||||
uc.mutation.SetMastodon(b)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableMastodon sets the "mastodon" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableMastodon(b *bool) *UserCreate {
|
|
||||||
if b != nil {
|
|
||||||
uc.SetMastodon(*b)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetDelete sets the "delete" field.
|
|
||||||
func (uc *UserCreate) SetDelete(b bool) *UserCreate {
|
|
||||||
uc.mutation.SetDelete(b)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableDelete sets the "delete" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableDelete(b *bool) *UserCreate {
|
|
||||||
if b != nil {
|
|
||||||
uc.SetDelete(*b)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetHandle sets the "handle" field.
|
|
||||||
func (uc *UserCreate) SetHandle(b bool) *UserCreate {
|
|
||||||
uc.mutation.SetHandle(b)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableHandle sets the "handle" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableHandle(b *bool) *UserCreate {
|
|
||||||
if b != nil {
|
|
||||||
uc.SetHandle(*b)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetToken sets the "token" field.
|
|
||||||
func (uc *UserCreate) SetToken(s string) *UserCreate {
|
|
||||||
uc.mutation.SetToken(s)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableToken sets the "token" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableToken(s *string) *UserCreate {
|
|
||||||
if s != nil {
|
|
||||||
uc.SetToken(*s)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetPassword sets the "password" field.
|
|
||||||
func (uc *UserCreate) SetPassword(s string) *UserCreate {
|
|
||||||
uc.mutation.SetPassword(s)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCreatedAt sets the "created_at" field.
|
// SetCreatedAt sets the "created_at" field.
|
||||||
func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate {
|
func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate {
|
||||||
uc.mutation.SetCreatedAt(t)
|
uc.mutation.SetCreatedAt(t)
|
||||||
@@ -145,230 +55,6 @@ func (uc *UserCreate) SetNillableUpdatedAt(t *time.Time) *UserCreate {
|
|||||||
return uc
|
return uc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRaidAt sets the "raid_at" field.
|
|
||||||
func (uc *UserCreate) SetRaidAt(t time.Time) *UserCreate {
|
|
||||||
uc.mutation.SetRaidAt(t)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableRaidAt sets the "raid_at" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableRaidAt(t *time.Time) *UserCreate {
|
|
||||||
if t != nil {
|
|
||||||
uc.SetRaidAt(*t)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLuck sets the "luck" field.
|
|
||||||
func (uc *UserCreate) SetLuck(i int) *UserCreate {
|
|
||||||
uc.mutation.SetLuck(i)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableLuck sets the "luck" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableLuck(i *int) *UserCreate {
|
|
||||||
if i != nil {
|
|
||||||
uc.SetLuck(*i)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLuckAt sets the "luck_at" field.
|
|
||||||
func (uc *UserCreate) SetLuckAt(t time.Time) *UserCreate {
|
|
||||||
uc.mutation.SetLuckAt(t)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableLuckAt sets the "luck_at" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableLuckAt(t *time.Time) *UserCreate {
|
|
||||||
if t != nil {
|
|
||||||
uc.SetLuckAt(*t)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLike sets the "like" field.
|
|
||||||
func (uc *UserCreate) SetLike(i int) *UserCreate {
|
|
||||||
uc.mutation.SetLike(i)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableLike sets the "like" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableLike(i *int) *UserCreate {
|
|
||||||
if i != nil {
|
|
||||||
uc.SetLike(*i)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLikeRank sets the "like_rank" field.
|
|
||||||
func (uc *UserCreate) SetLikeRank(i int) *UserCreate {
|
|
||||||
uc.mutation.SetLikeRank(i)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableLikeRank sets the "like_rank" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableLikeRank(i *int) *UserCreate {
|
|
||||||
if i != nil {
|
|
||||||
uc.SetLikeRank(*i)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLikeAt sets the "like_at" field.
|
|
||||||
func (uc *UserCreate) SetLikeAt(t time.Time) *UserCreate {
|
|
||||||
uc.mutation.SetLikeAt(t)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableLikeAt sets the "like_at" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableLikeAt(t *time.Time) *UserCreate {
|
|
||||||
if t != nil {
|
|
||||||
uc.SetLikeAt(*t)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetFav sets the "fav" field.
|
|
||||||
func (uc *UserCreate) SetFav(i int) *UserCreate {
|
|
||||||
uc.mutation.SetFav(i)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableFav sets the "fav" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableFav(i *int) *UserCreate {
|
|
||||||
if i != nil {
|
|
||||||
uc.SetFav(*i)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTen sets the "ten" field.
|
|
||||||
func (uc *UserCreate) SetTen(b bool) *UserCreate {
|
|
||||||
uc.mutation.SetTen(b)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTen sets the "ten" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTen(b *bool) *UserCreate {
|
|
||||||
if b != nil {
|
|
||||||
uc.SetTen(*b)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTenSu sets the "ten_su" field.
|
|
||||||
func (uc *UserCreate) SetTenSu(i int) *UserCreate {
|
|
||||||
uc.mutation.SetTenSu(i)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTenSu sets the "ten_su" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTenSu(i *int) *UserCreate {
|
|
||||||
if i != nil {
|
|
||||||
uc.SetTenSu(*i)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTenKai sets the "ten_kai" field.
|
|
||||||
func (uc *UserCreate) SetTenKai(i int) *UserCreate {
|
|
||||||
uc.mutation.SetTenKai(i)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTenKai sets the "ten_kai" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTenKai(i *int) *UserCreate {
|
|
||||||
if i != nil {
|
|
||||||
uc.SetTenKai(*i)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetAiten sets the "aiten" field.
|
|
||||||
func (uc *UserCreate) SetAiten(i int) *UserCreate {
|
|
||||||
uc.mutation.SetAiten(i)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableAiten sets the "aiten" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableAiten(i *int) *UserCreate {
|
|
||||||
if i != nil {
|
|
||||||
uc.SetAiten(*i)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTenCard sets the "ten_card" field.
|
|
||||||
func (uc *UserCreate) SetTenCard(s string) *UserCreate {
|
|
||||||
uc.mutation.SetTenCard(s)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTenCard sets the "ten_card" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTenCard(s *string) *UserCreate {
|
|
||||||
if s != nil {
|
|
||||||
uc.SetTenCard(*s)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTenDelete sets the "ten_delete" field.
|
|
||||||
func (uc *UserCreate) SetTenDelete(s string) *UserCreate {
|
|
||||||
uc.mutation.SetTenDelete(s)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTenDelete sets the "ten_delete" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTenDelete(s *string) *UserCreate {
|
|
||||||
if s != nil {
|
|
||||||
uc.SetTenDelete(*s)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTenPost sets the "ten_post" field.
|
|
||||||
func (uc *UserCreate) SetTenPost(s string) *UserCreate {
|
|
||||||
uc.mutation.SetTenPost(s)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTenPost sets the "ten_post" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTenPost(s *string) *UserCreate {
|
|
||||||
if s != nil {
|
|
||||||
uc.SetTenPost(*s)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTenGet sets the "ten_get" field.
|
|
||||||
func (uc *UserCreate) SetTenGet(s string) *UserCreate {
|
|
||||||
uc.mutation.SetTenGet(s)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTenGet sets the "ten_get" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTenGet(s *string) *UserCreate {
|
|
||||||
if s != nil {
|
|
||||||
uc.SetTenGet(*s)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetTenAt sets the "ten_at" field.
|
|
||||||
func (uc *UserCreate) SetTenAt(t time.Time) *UserCreate {
|
|
||||||
uc.mutation.SetTenAt(t)
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNillableTenAt sets the "ten_at" field if the given value is not nil.
|
|
||||||
func (uc *UserCreate) SetNillableTenAt(t *time.Time) *UserCreate {
|
|
||||||
if t != nil {
|
|
||||||
uc.SetTenAt(*t)
|
|
||||||
}
|
|
||||||
return uc
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetNext sets the "next" field.
|
// SetNext sets the "next" field.
|
||||||
func (uc *UserCreate) SetNext(s string) *UserCreate {
|
func (uc *UserCreate) SetNext(s string) *UserCreate {
|
||||||
uc.mutation.SetNext(s)
|
uc.mutation.SetNext(s)
|
||||||
@@ -433,22 +119,6 @@ func (uc *UserCreate) ExecX(ctx context.Context) {
|
|||||||
|
|
||||||
// defaults sets the default values of the builder before save.
|
// defaults sets the default values of the builder before save.
|
||||||
func (uc *UserCreate) defaults() {
|
func (uc *UserCreate) defaults() {
|
||||||
if _, ok := uc.mutation.Bsky(); !ok {
|
|
||||||
v := user.DefaultBsky
|
|
||||||
uc.mutation.SetBsky(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.Mastodon(); !ok {
|
|
||||||
v := user.DefaultMastodon
|
|
||||||
uc.mutation.SetMastodon(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.Delete(); !ok {
|
|
||||||
v := user.DefaultDelete
|
|
||||||
uc.mutation.SetDelete(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.Handle(); !ok {
|
|
||||||
v := user.DefaultHandle
|
|
||||||
uc.mutation.SetHandle(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.CreatedAt(); !ok {
|
if _, ok := uc.mutation.CreatedAt(); !ok {
|
||||||
v := user.DefaultCreatedAt()
|
v := user.DefaultCreatedAt()
|
||||||
uc.mutation.SetCreatedAt(v)
|
uc.mutation.SetCreatedAt(v)
|
||||||
@@ -457,22 +127,6 @@ func (uc *UserCreate) defaults() {
|
|||||||
v := user.DefaultUpdatedAt()
|
v := user.DefaultUpdatedAt()
|
||||||
uc.mutation.SetUpdatedAt(v)
|
uc.mutation.SetUpdatedAt(v)
|
||||||
}
|
}
|
||||||
if _, ok := uc.mutation.RaidAt(); !ok {
|
|
||||||
v := user.DefaultRaidAt()
|
|
||||||
uc.mutation.SetRaidAt(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.LuckAt(); !ok {
|
|
||||||
v := user.DefaultLuckAt()
|
|
||||||
uc.mutation.SetLuckAt(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.LikeAt(); !ok {
|
|
||||||
v := user.DefaultLikeAt()
|
|
||||||
uc.mutation.SetLikeAt(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.TenAt(); !ok {
|
|
||||||
v := user.DefaultTenAt()
|
|
||||||
uc.mutation.SetTenAt(v)
|
|
||||||
}
|
|
||||||
if _, ok := uc.mutation.Next(); !ok {
|
if _, ok := uc.mutation.Next(); !ok {
|
||||||
v := user.DefaultNext
|
v := user.DefaultNext
|
||||||
uc.mutation.SetNext(v)
|
uc.mutation.SetNext(v)
|
||||||
@@ -489,14 +143,6 @@ func (uc *UserCreate) check() error {
|
|||||||
return &ValidationError{Name: "username", err: fmt.Errorf(`ent: validator failed for field "User.username": %w`, err)}
|
return &ValidationError{Name: "username", err: fmt.Errorf(`ent: validator failed for field "User.username": %w`, err)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := uc.mutation.Password(); !ok {
|
|
||||||
return &ValidationError{Name: "password", err: errors.New(`ent: missing required field "User.password"`)}
|
|
||||||
}
|
|
||||||
if v, ok := uc.mutation.Password(); ok {
|
|
||||||
if err := user.PasswordValidator(v); err != nil {
|
|
||||||
return &ValidationError{Name: "password", err: fmt.Errorf(`ent: validator failed for field "User.password": %w`, err)}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,34 +173,6 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(user.FieldUsername, field.TypeString, value)
|
_spec.SetField(user.FieldUsername, field.TypeString, value)
|
||||||
_node.Username = value
|
_node.Username = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.Did(); ok {
|
|
||||||
_spec.SetField(user.FieldDid, field.TypeString, value)
|
|
||||||
_node.Did = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Bsky(); ok {
|
|
||||||
_spec.SetField(user.FieldBsky, field.TypeBool, value)
|
|
||||||
_node.Bsky = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Mastodon(); ok {
|
|
||||||
_spec.SetField(user.FieldMastodon, field.TypeBool, value)
|
|
||||||
_node.Mastodon = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Delete(); ok {
|
|
||||||
_spec.SetField(user.FieldDelete, field.TypeBool, value)
|
|
||||||
_node.Delete = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Handle(); ok {
|
|
||||||
_spec.SetField(user.FieldHandle, field.TypeBool, value)
|
|
||||||
_node.Handle = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Token(); ok {
|
|
||||||
_spec.SetField(user.FieldToken, field.TypeString, value)
|
|
||||||
_node.Token = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Password(); ok {
|
|
||||||
_spec.SetField(user.FieldPassword, field.TypeString, value)
|
|
||||||
_node.Password = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.CreatedAt(); ok {
|
if value, ok := uc.mutation.CreatedAt(); ok {
|
||||||
_spec.SetField(user.FieldCreatedAt, field.TypeTime, value)
|
_spec.SetField(user.FieldCreatedAt, field.TypeTime, value)
|
||||||
_node.CreatedAt = value
|
_node.CreatedAt = value
|
||||||
@@ -563,70 +181,6 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
|
_spec.SetField(user.FieldUpdatedAt, field.TypeTime, value)
|
||||||
_node.UpdatedAt = value
|
_node.UpdatedAt = value
|
||||||
}
|
}
|
||||||
if value, ok := uc.mutation.RaidAt(); ok {
|
|
||||||
_spec.SetField(user.FieldRaidAt, field.TypeTime, value)
|
|
||||||
_node.RaidAt = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Luck(); ok {
|
|
||||||
_spec.SetField(user.FieldLuck, field.TypeInt, value)
|
|
||||||
_node.Luck = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.LuckAt(); ok {
|
|
||||||
_spec.SetField(user.FieldLuckAt, field.TypeTime, value)
|
|
||||||
_node.LuckAt = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Like(); ok {
|
|
||||||
_spec.SetField(user.FieldLike, field.TypeInt, value)
|
|
||||||
_node.Like = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.LikeRank(); ok {
|
|
||||||
_spec.SetField(user.FieldLikeRank, field.TypeInt, value)
|
|
||||||
_node.LikeRank = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.LikeAt(); ok {
|
|
||||||
_spec.SetField(user.FieldLikeAt, field.TypeTime, value)
|
|
||||||
_node.LikeAt = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Fav(); ok {
|
|
||||||
_spec.SetField(user.FieldFav, field.TypeInt, value)
|
|
||||||
_node.Fav = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Ten(); ok {
|
|
||||||
_spec.SetField(user.FieldTen, field.TypeBool, value)
|
|
||||||
_node.Ten = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.TenSu(); ok {
|
|
||||||
_spec.SetField(user.FieldTenSu, field.TypeInt, value)
|
|
||||||
_node.TenSu = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.TenKai(); ok {
|
|
||||||
_spec.SetField(user.FieldTenKai, field.TypeInt, value)
|
|
||||||
_node.TenKai = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Aiten(); ok {
|
|
||||||
_spec.SetField(user.FieldAiten, field.TypeInt, value)
|
|
||||||
_node.Aiten = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.TenCard(); ok {
|
|
||||||
_spec.SetField(user.FieldTenCard, field.TypeString, value)
|
|
||||||
_node.TenCard = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.TenDelete(); ok {
|
|
||||||
_spec.SetField(user.FieldTenDelete, field.TypeString, value)
|
|
||||||
_node.TenDelete = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.TenPost(); ok {
|
|
||||||
_spec.SetField(user.FieldTenPost, field.TypeString, value)
|
|
||||||
_node.TenPost = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.TenGet(); ok {
|
|
||||||
_spec.SetField(user.FieldTenGet, field.TypeString, value)
|
|
||||||
_node.TenGet = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.TenAt(); ok {
|
|
||||||
_spec.SetField(user.FieldTenAt, field.TypeTime, value)
|
|
||||||
_node.TenAt = value
|
|
||||||
}
|
|
||||||
if value, ok := uc.mutation.Next(); ok {
|
if value, ok := uc.mutation.Next(); ok {
|
||||||
_spec.SetField(user.FieldNext, field.TypeString, value)
|
_spec.SetField(user.FieldNext, field.TypeString, value)
|
||||||
_node.Next = value
|
_node.Next = value
|
||||||
@@ -639,7 +193,10 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
|
|||||||
Columns: []string{user.CardColumn},
|
Columns: []string{user.CardColumn},
|
||||||
Bidi: false,
|
Bidi: false,
|
||||||
Target: &sqlgraph.EdgeTarget{
|
Target: &sqlgraph.EdgeTarget{
|
||||||
IDSpec: sqlgraph.NewFieldSpec(card.FieldID, field.TypeInt),
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: card.FieldID,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, k := range nodes {
|
for _, k := range nodes {
|
||||||
|
1314
ent/user_update.go
1314
ent/user_update.go
File diff suppressed because it is too large
Load Diff
6
go.mod
6
go.mod
@@ -5,7 +5,7 @@ go 1.19
|
|||||||
//replace ariga.io/ogent => ../../
|
//replace ariga.io/ogent => ../../
|
||||||
|
|
||||||
require (
|
require (
|
||||||
entgo.io/ent v0.11.10
|
entgo.io/ent v0.11.9
|
||||||
github.com/go-faster/errors v0.6.1
|
github.com/go-faster/errors v0.6.1
|
||||||
github.com/go-faster/jx v0.42.0-alpha.1
|
github.com/go-faster/jx v0.42.0-alpha.1
|
||||||
github.com/mattn/go-sqlite3 v1.14.16
|
github.com/mattn/go-sqlite3 v1.14.16
|
||||||
@@ -18,7 +18,7 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
ariga.io/atlas v0.9.2-0.20230303073438-03a4779a6338 // indirect
|
ariga.io/atlas v0.9.1 // indirect
|
||||||
ariga.io/entviz v0.0.0-20230125130633-6c9be8e08c7c // indirect
|
ariga.io/entviz v0.0.0-20230125130633-6c9be8e08c7c // indirect
|
||||||
ariga.io/ogent v0.0.0-20230309073626-8dc564a6a73e // indirect
|
ariga.io/ogent v0.0.0-20230309073626-8dc564a6a73e // indirect
|
||||||
entgo.io/contrib v0.3.5 // indirect
|
entgo.io/contrib v0.3.5 // indirect
|
||||||
@@ -31,12 +31,10 @@ require (
|
|||||||
github.com/go-logr/logr v1.2.3 // indirect
|
github.com/go-logr/logr v1.2.3 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-openapi/inflect v0.19.0 // indirect
|
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
github.com/golang/mock v1.6.0 // indirect
|
||||||
github.com/google/go-cmp v0.5.9 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0 // indirect
|
github.com/hashicorp/hcl/v2 v2.15.0 // indirect
|
||||||
github.com/joho/godotenv v1.5.1 // indirect
|
|
||||||
github.com/kyokomi/lottery v1.2.0 // indirect
|
github.com/kyokomi/lottery v1.2.0 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||||
|
11
go.sum
11
go.sum
@@ -1,7 +1,5 @@
|
|||||||
ariga.io/atlas v0.9.1 h1:EpoPMnwsQG0vn9c0sYExpwSYtr7bvuSUXzQclU2pMjc=
|
ariga.io/atlas v0.9.1 h1:EpoPMnwsQG0vn9c0sYExpwSYtr7bvuSUXzQclU2pMjc=
|
||||||
ariga.io/atlas v0.9.1/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU=
|
ariga.io/atlas v0.9.1/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU=
|
||||||
ariga.io/atlas v0.9.2-0.20230303073438-03a4779a6338 h1:8kmSV3mbQKn0niZ/EdE11uhFvFKiW1VlaqVBIYOyahM=
|
|
||||||
ariga.io/atlas v0.9.2-0.20230303073438-03a4779a6338/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU=
|
|
||||||
ariga.io/entviz v0.0.0-20230125130633-6c9be8e08c7c h1:7FbOjKKWKqD7FZXQq3qWcRlvGFO1LGYvVZIWQ2D9Evs=
|
ariga.io/entviz v0.0.0-20230125130633-6c9be8e08c7c h1:7FbOjKKWKqD7FZXQq3qWcRlvGFO1LGYvVZIWQ2D9Evs=
|
||||||
ariga.io/entviz v0.0.0-20230125130633-6c9be8e08c7c/go.mod h1:wArXZPqbbWBcOmkqwmIF6hIcW+3T1NLDde0iRhW6an8=
|
ariga.io/entviz v0.0.0-20230125130633-6c9be8e08c7c/go.mod h1:wArXZPqbbWBcOmkqwmIF6hIcW+3T1NLDde0iRhW6an8=
|
||||||
ariga.io/ogent v0.0.0-20230309073626-8dc564a6a73e h1:8mxC+4Y7pVKgfoUJIMdChrS95d+TcJ6xuhw49nVYIAY=
|
ariga.io/ogent v0.0.0-20230309073626-8dc564a6a73e h1:8mxC+4Y7pVKgfoUJIMdChrS95d+TcJ6xuhw49nVYIAY=
|
||||||
@@ -10,8 +8,6 @@ entgo.io/contrib v0.3.5 h1:wY85TgRp3j5ix/SZ9IE6Ob5lObHFmVUYH0ZFw1D5Hzc=
|
|||||||
entgo.io/contrib v0.3.5/go.mod h1:R5HiFszVD8OVOZKFGRbqYogRxK7z1ruzWyEEesjQwE0=
|
entgo.io/contrib v0.3.5/go.mod h1:R5HiFszVD8OVOZKFGRbqYogRxK7z1ruzWyEEesjQwE0=
|
||||||
entgo.io/ent v0.11.9 h1:dbbCkAiPVTRBIJwoZctiSYjB7zxQIBOzVSU5H9VYIQI=
|
entgo.io/ent v0.11.9 h1:dbbCkAiPVTRBIJwoZctiSYjB7zxQIBOzVSU5H9VYIQI=
|
||||||
entgo.io/ent v0.11.9/go.mod h1:KWHOcDZn1xk3mz3ipWdKrQpMvwqa/9B69TUuAPP9W6g=
|
entgo.io/ent v0.11.9/go.mod h1:KWHOcDZn1xk3mz3ipWdKrQpMvwqa/9B69TUuAPP9W6g=
|
||||||
entgo.io/ent v0.11.10 h1:iqn32ybY5HRW3xSAyMNdNKpZhKgMf1Zunsej9yPKUI8=
|
|
||||||
entgo.io/ent v0.11.10/go.mod h1:mzTZ0trE+jCQw/fnzijbm5Mck/l8Gbg7gC/+L1COyzM=
|
|
||||||
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
|
||||||
github.com/Khan/genqlient v0.5.0 h1:TMZJ+tl/BpbmGyIBiXzKzUftDhw4ZWxQZ+1ydn0gyII=
|
github.com/Khan/genqlient v0.5.0 h1:TMZJ+tl/BpbmGyIBiXzKzUftDhw4ZWxQZ+1ydn0gyII=
|
||||||
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
||||||
@@ -42,7 +38,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
|
|||||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||||
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||||
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
|
||||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||||
@@ -52,8 +47,6 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
|||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8=
|
github.com/hashicorp/hcl/v2 v2.15.0 h1:CPDXO6+uORPjKflkWCCwoWc9uRp+zSIPcCQ+BrxV7m8=
|
||||||
github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
|
github.com/hashicorp/hcl/v2 v2.15.0/go.mod h1:JRmR89jycNkrrqnMmvPDMd56n1rQJ2Q6KocSLCMCXng=
|
||||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
|
||||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
@@ -68,7 +61,6 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
|||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||||
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
|
||||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
github.com/mazen160/go-random v0.0.0-20210308102632-d2b501c85c03 h1:iM7JTVzKOYKWjzhGcgHAgFVQt5QfiHIVrRUaWPfh0Q4=
|
github.com/mazen160/go-random v0.0.0-20210308102632-d2b501c85c03 h1:iM7JTVzKOYKWjzhGcgHAgFVQt5QfiHIVrRUaWPfh0Q4=
|
||||||
@@ -77,7 +69,6 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ
|
|||||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||||
github.com/ogen-go/ogen v0.59.0 h1:9aSSZ1KCLJIcRyjkO7IHrG0vAI6l1BO877LwTbMcX+k=
|
github.com/ogen-go/ogen v0.59.0 h1:9aSSZ1KCLJIcRyjkO7IHrG0vAI6l1BO877LwTbMcX+k=
|
||||||
github.com/ogen-go/ogen v0.59.0/go.mod h1:0MHLcWEbxwdvR+R9E05paQSRh/2vHtVSJgKqmwYyW8M=
|
github.com/ogen-go/ogen v0.59.0/go.mod h1:0MHLcWEbxwdvR+R9E05paQSRh/2vHtVSJgKqmwYyW8M=
|
||||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
@@ -85,8 +76,6 @@ github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
|
|||||||
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
|
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
|
||||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
|
||||||
github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU=
|
github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU=
|
||||||
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
|
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
13
main.go
13
main.go
@@ -9,7 +9,6 @@ import (
|
|||||||
"t/ent/ogent"
|
"t/ent/ogent"
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"entgo.io/ent/dialect/sql/schema"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -51,20 +50,14 @@ func (h handler) DrawDone(ctx context.Context, params ogent.DrawDoneParams) erro
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Create ent client.
|
// Create ent client.
|
||||||
client, err := ent.Open(dialect.SQLite, "file:/data/new.sqlite?_fk=1")
|
client, err := ent.Open(dialect.SQLite, "file:/data/ent.sqlite?_fk=1")
|
||||||
//client, err := ent.Open(dialect.SQLite, "file:data/new.sqlite?_fk=1")
|
|
||||||
//client, err := ent.Open(dialect.SQLite, "file:data?mode=memory&cache=shared&_fk=1")
|
//client, err := ent.Open(dialect.SQLite, "file:data?mode=memory&cache=shared&_fk=1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
// Run the migrations.
|
// Run the migrations.
|
||||||
//if err := client.Schema.Create(context.Background()); err != nil {
|
if err := client.Schema.Create(context.Background()); err != nil {
|
||||||
// log.Fatal(err)
|
log.Fatal(err)
|
||||||
//}
|
|
||||||
ctx := context.Background()
|
|
||||||
err = client.Schema.Create(ctx, schema.WithAtlas(true))
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("failed creating schema resources: %v", err)
|
|
||||||
}
|
}
|
||||||
// Create the handler.
|
// Create the handler.
|
||||||
h := handler{
|
h := handler{
|
||||||
|
31
readme.md
31
readme.md
@@ -8,10 +8,9 @@ $ go build
|
|||||||
$ ./card
|
$ ./card
|
||||||
|
|
||||||
$ go generate ./...
|
$ go generate ./...
|
||||||
$ PASS=`cat ./token.json|jq -r .password` TOKEN=`cat ./token.json|jq -r .token` go run -mod=mod main.go
|
$ go run -mod=mod main.go
|
||||||
$ curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"syui\",\"password\":\"$pass\"}" localhost:8080/users
|
$ curl -X POST -H "Content-Type: application/json" -d '{"username":"syui"}' localhost:8080/users
|
||||||
$ curl -X POST -H "Content-Type: application/json" -d "{\"owner\":1,\"password\":\"$pass\"}" localhost:8080/cards
|
$ curl -X POST -H "Content-Type: application/json" -d '{"owner":1}' localhost:8080/cards
|
||||||
$ curl -X POST -H "Content-Type: application/json" -d "{\"owner\":1,\"card\":1,\"cp\":11,\"status\":\"normal\",\"password\":\"$pass\"}" localhost:8080/cards
|
|
||||||
$ curl localhost:8080/users
|
$ curl localhost:8080/users
|
||||||
$ curl localhost:8080/cards
|
$ curl localhost:8080/cards
|
||||||
$ curl localhost:8080/users/1
|
$ curl localhost:8080/users/1
|
||||||
@@ -21,7 +20,7 @@ $ curl localhost:8080/users/1/card
|
|||||||
### use
|
### use
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ curl -X POST -H "Content-Type: application/json" -d '{"username":"syui",\"password\":\"$pass\"}' https://api.syui.ai/users
|
$ curl -X POST -H "Content-Type: application/json" -d '{"username":"syui"}' https://api.syui.ai/users
|
||||||
|
|
||||||
# onconflict
|
# onconflict
|
||||||
$ !!
|
$ !!
|
||||||
@@ -29,13 +28,6 @@ $ !!
|
|||||||
$ curl -sL https://api.syui.ai/users/1
|
$ curl -sL https://api.syui.ai/users/1
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
|
||||||
# item select
|
|
||||||
$ curl -sL "https://api.syui.ai/users?itemsPerPage=255"
|
|
||||||
$ curl -sL "https://api.syui.ai/cards?itemsPerPage=255"
|
|
||||||
$ curl -sL "https://api.syui.ai/users/1/card?itemsPerPage=255"
|
|
||||||
```
|
|
||||||
|
|
||||||
### ref
|
### ref
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -77,18 +69,3 @@ func (h *OgentHandler) UpdateUsers(ctx context.Context, req UpdateUsersReq, para
|
|||||||
|
|
||||||
- https://github.com/go-kratos/beer-shop/tree/main/app/catalog/service/internal/data/ent
|
- https://github.com/go-kratos/beer-shop/tree/main/app/catalog/service/internal/data/ent
|
||||||
|
|
||||||
|
|
||||||
### update
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ curl --dump-header - 'https://api.syui.ai/users' -H 'Origin: https://card.syui.ai'|less
|
|
||||||
```
|
|
||||||
|
|
||||||
> ent/ogent/oas_response_encoders_gen.go
|
|
||||||
|
|
||||||
```go
|
|
||||||
func encodeCreateGroupResponse(response CreateGroupRes, w http.ResponseWriter, span trace.Span) error {
|
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
switch response := response.(type) {
|
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
|
||||||
```
|
|
||||||
|
3
run.zsh
3
run.zsh
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
d=${0:a:h}
|
|
||||||
PASS=`cat token.json|jq -r .password` go run -mod=mod main.go
|
|
@@ -1,31 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
echo old_id new_id
|
|
||||||
host=https://api.syui.ai
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
|
||||||
if [ -z "$1" ];then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
if [ -z "$2" ];then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo old-id new-id
|
|
||||||
|
|
||||||
id=$1
|
|
||||||
data=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
|
|
||||||
echo $data
|
|
||||||
id_n=$2
|
|
||||||
echo $id_n
|
|
||||||
read
|
|
||||||
|
|
||||||
n=`echo $data|jq length`
|
|
||||||
n=$((n - 1))
|
|
||||||
|
|
||||||
for ((i=0;i<=$n;i++))
|
|
||||||
do
|
|
||||||
card=`echo $data|jq -r ".[$i].card"`
|
|
||||||
s=`echo $data|jq -r ".[$i].status"`
|
|
||||||
cp=`echo $data|jq -r ".[$i].cp"`
|
|
||||||
skill=`echo $data|jq -r ".[$i].skill"`
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id_n,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards
|
|
||||||
done
|
|
@@ -1,12 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
echo id
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .pass`
|
|
||||||
if [ -z "$1" ];then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
id=$1
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":true,\"token\":\"$token\"}" -s $host/users/$id
|
|
||||||
|
|
@@ -1,27 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
|
||||||
d=${0:a:h}
|
|
||||||
f=$d/t.txt
|
|
||||||
|
|
||||||
if [ -z "$1" ];then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f $f ];then
|
|
||||||
echo $f
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
id=$1
|
|
||||||
n=`cat $f|wc -l`
|
|
||||||
|
|
||||||
for ((i=1;i<=$n;i++))
|
|
||||||
do
|
|
||||||
card=`cat $d/t.txt|awk "NR==$i"`
|
|
||||||
echo $card
|
|
||||||
read
|
|
||||||
curl -X DELETE -H "Content-Type: application/json" -d "{'owner':\"$id\"}" https://api.syui.ai/cards/$card
|
|
||||||
done
|
|
||||||
|
|
||||||
rm $d/t.txt
|
|
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
host=https://api.syui.ai
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
|
||||||
if [ -z "$1" ];then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
if [ -z "$2" ];then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
if [ -z "$3" ];then
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo username card cp
|
|
||||||
read
|
|
||||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
|
||||||
card=$2
|
|
||||||
cp=$3
|
|
||||||
s=super
|
|
||||||
skill=normal
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards
|
|
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
echo id
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
echo $token
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .pass`
|
|
||||||
if [ -z "$1" ];then
|
|
||||||
echo 1 : id
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
if [ -z "$2" ];then
|
|
||||||
echo 2 : did
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
id=$1
|
|
||||||
did=$2
|
|
||||||
|
|
||||||
id=$1
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"did\":\"$did\",\"token\":\"$token\"}" -s $host/users/$id
|
|
@@ -1,29 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias date="/opt/homebrew/bin/gdate"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
card_status=first
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
|
|
||||||
data=`curl -sL "https://api.syui.ai/users?itemsPerPage=2555"`
|
|
||||||
fav=`echo $data|jq ".[]|select(.fav != 0)|.fav"`
|
|
||||||
id=`echo $data|jq ".[]|select(.fav != 0)|.id"`
|
|
||||||
|
|
||||||
n=`echo $fav|wc -l`
|
|
||||||
echo $n
|
|
||||||
|
|
||||||
for ((i=1;i<=$n;i++))
|
|
||||||
do
|
|
||||||
cid=`echo $fav|awk "NR==$i"`
|
|
||||||
uid=`echo $id|awk "NR==$i"`
|
|
||||||
#check
|
|
||||||
u_data=`curl -sL "https://api.syui.ai/users/$uid/card?itemsPerPage=2555"|jq -r ".[]|select(.status == \"first\")"`
|
|
||||||
if [ -z "$u_data" ];then
|
|
||||||
echo no $uid $cid
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"status\":\"$card_status\",\"token\":\"$token\"}" $host/cards/$cid
|
|
||||||
fi
|
|
||||||
done
|
|
@@ -1,32 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias date="/opt/homebrew/bin/gdate"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
card_status=second
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
|
|
||||||
data=`curl -sL "https://api.syui.ai/users?itemsPerPage=2555"`
|
|
||||||
fav=`echo $data|jq ".[]|select(.fav != 0)|.fav"`
|
|
||||||
id=`echo $data|jq ".[]|select(.fav != 0)|.id"`
|
|
||||||
|
|
||||||
n=`echo $fav|wc -l`
|
|
||||||
echo $n
|
|
||||||
|
|
||||||
for ((i=1;i<=$n;i++))
|
|
||||||
do
|
|
||||||
cid=`echo $fav|awk "NR==$i"`
|
|
||||||
uid=`echo $id|awk "NR==$i"`
|
|
||||||
#check
|
|
||||||
u_data=`curl -sL "https://api.syui.ai/users/$uid/card?itemsPerPage=2555"|jq -r ".[]|select(.status == \"second\" or \"second\")"`
|
|
||||||
if [ -z "$u_data" ];then
|
|
||||||
d_data=`curl -sL $host/cards/$cid|jq -r "select(.status == \"first\")"`
|
|
||||||
echo $d_data
|
|
||||||
if [ -z "$d_data" ];then
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"status\":\"$card_status\",\"token\":\"$token\"}" $host/cards/$cid
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
@@ -1,40 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias date="/opt/homebrew/bin/gdate"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
host_users="$host/users?itemsPerPage=2550"
|
|
||||||
updated_at_n=`date --iso-8601=seconds -d '1 days ago'`
|
|
||||||
now_at=`date --iso-8601=seconds`
|
|
||||||
raid_at_n=`date --iso-8601=seconds -d '1 days ago'`
|
|
||||||
data=`curl -sL "$host_users"|jq .`
|
|
||||||
nd=`date +"%Y%m%d"`
|
|
||||||
|
|
||||||
n=`echo $data|jq length`
|
|
||||||
n=$((n - 1))
|
|
||||||
|
|
||||||
if [ -n "$1" ];then
|
|
||||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
|
||||||
if [ "ai" = "$1" ] || [ "yui" = "$1" ];then
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"luck\": 7, \"like\":0,\"aiten\":1000}" -s $host/users/$id
|
|
||||||
else
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$updated_at_n\", \"ten_at\": \"$updated_at_n\",\"token\": \"$token\"}" -s $host/users/$id
|
|
||||||
fi
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
for ((i=0;i<=$n;i++))
|
|
||||||
do
|
|
||||||
name=`echo $data|jq ".[$i]"|jq -r .username`
|
|
||||||
id=`echo $data|jq ".[$i]"|jq -r .id`
|
|
||||||
echo "{\"updated_at\":\"$updated_at_n\"} -s $host/users/$id"
|
|
||||||
if [ "ai" = "$1" ];then
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"luck\": 7}" -s $host/users/$id
|
|
||||||
else
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"ten_at\": \"$updated_at_n\"}" -s $host/users/$id
|
|
||||||
fi
|
|
||||||
done
|
|
@@ -1,69 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
host=https://api.syui.ai
|
|
||||||
api=localhost:8080
|
|
||||||
|
|
||||||
host_users="$host/users?itemsPerPage=2550"
|
|
||||||
d=${0:a:h}
|
|
||||||
dd=${0:a:h:h}
|
|
||||||
pass=`cat $dd/token.json|jq -r .password`
|
|
||||||
host_at=bsky.social
|
|
||||||
|
|
||||||
if [ -f $d/user.json ] && [ "$1" = "-s" ];then
|
|
||||||
rm $d/user.json
|
|
||||||
fi
|
|
||||||
function did() {
|
|
||||||
unset did
|
|
||||||
url="https://$host_at/xrpc/com.atproto.repo.listRecords?repo=${name}.${host_at}&collection=app.bsky.actor.profile"
|
|
||||||
if [ "`curl -sL $url| jq -r .error`" = "null" ];then
|
|
||||||
t=`curl -sL $url | jq -r ".records|.[]|.uri"|cut -d / -f 3`
|
|
||||||
did=$t
|
|
||||||
else
|
|
||||||
#did=`curl -sL "search.bsky.social/search/posts?q=$name" | jq -r ".[0].user.did"`
|
|
||||||
did="null"
|
|
||||||
fi
|
|
||||||
echo "{\"name\":\"$name\",\"did\":\"$did\"}," >> $d/user.json
|
|
||||||
}
|
|
||||||
|
|
||||||
function l_users() {
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"$name\",\"password\":\"$pass\",\"did\":\"$did\"}" $api/users
|
|
||||||
#sleep 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function l_cards() {
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\"}" $api/cards
|
|
||||||
#sleep 1
|
|
||||||
}
|
|
||||||
|
|
||||||
data=`curl -sL "$host_users"|jq .`
|
|
||||||
n=`echo $data|jq length`
|
|
||||||
n=$((n - 1))
|
|
||||||
for ((i=0;i<=$n;i++))
|
|
||||||
do
|
|
||||||
|
|
||||||
name=`echo $data|jq ".[$i]"|jq -r .username`
|
|
||||||
id=`echo $data|jq ".[$i]"|jq -r .id`
|
|
||||||
did=`echo $data|jq ".[$i]"|jq -r .did`
|
|
||||||
|
|
||||||
echo "{\"username\":\"$name\", \"password\":\"$pass\",\"did\":\"$did\"} localhost:8080/users"
|
|
||||||
if [ "$1" = "-a" ];then
|
|
||||||
l_users
|
|
||||||
fi
|
|
||||||
|
|
||||||
data_card=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
|
|
||||||
nn=`echo $data_card|jq length`
|
|
||||||
nn=$((nn - 1))
|
|
||||||
|
|
||||||
if [ "$1" != "-s" ];then
|
|
||||||
for ((ii=0;ii<=$nn;ii++))
|
|
||||||
do
|
|
||||||
card=`echo $data_card|jq -r ".[$ii].card"`
|
|
||||||
s=`echo $data_card|jq -r ".[$ii].status"`
|
|
||||||
cp=`echo $data_card|jq -r ".[$ii].cp"`
|
|
||||||
echo "{\"owner\":$id,\"card\":\"$card\",\"status\":\"$s\",\"cp\":\"$cp\", \"password\":\"$pass\"} localhost:8080/cards"
|
|
||||||
if [ "$1" = "-a" ];then
|
|
||||||
l_cards
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
@@ -1,79 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias date="/opt/homebrew/bin/gdate"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
username=ai
|
|
||||||
id=2
|
|
||||||
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
|
||||||
host_users="$host/users?itemsPerPage=255"
|
|
||||||
data=`curl -sL "$host_users"|jq .`
|
|
||||||
nd=`date +"%Y%m%d"`
|
|
||||||
nd=20230101
|
|
||||||
|
|
||||||
#title=card_patch
|
|
||||||
#echo $title
|
|
||||||
#card_id=1
|
|
||||||
#curl -X PATCH -H "Content-Type: application/json" -d "{\"cp\":1,\"token\":\"$token\"}" $host/cards/$card_id
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
## card pass
|
|
||||||
echo "\ntest get card (no password)"
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id}" $host/cards
|
|
||||||
echo "\ntest select card (no password)"
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":0,\"status\":\"normal\",\"cp\":1}" $host/cards
|
|
||||||
|
|
||||||
## token
|
|
||||||
echo "\ntest token (no token)"
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"1\"}" -s $host/users/$id
|
|
||||||
echo "\ntest token (yes token)"
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\",\"token\":\"$token\"}" -s $host/users/$id
|
|
||||||
|
|
||||||
read
|
|
||||||
|
|
||||||
## users
|
|
||||||
curl -sL "$host/users?itemsPerPage=2550"|jq .
|
|
||||||
read
|
|
||||||
curl -sL "$host/users/$id?itemsPerPage=2550"|jq .
|
|
||||||
read
|
|
||||||
curl -sL "$host/users/$id/card?itemsPerPage=2550"|jq .
|
|
||||||
read
|
|
||||||
|
|
||||||
## cards
|
|
||||||
curl -sL "$host/cards?itemsPerPage=2550"|jq .
|
|
||||||
read
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
read
|
|
||||||
## delete
|
|
||||||
echo "\ntest delete"
|
|
||||||
data=`curl -sL https://api.syui.ai/users/$id/card`
|
|
||||||
n=`echo $data|jq length`
|
|
||||||
n=$((n - 1))
|
|
||||||
|
|
||||||
for ((i=0;i<=$n;i++))
|
|
||||||
do
|
|
||||||
card=`echo $data|jq -r ".[$i].id"`
|
|
||||||
echo "\ncard id : $card"
|
|
||||||
curl -X DELETE -H "Content-Type: application/json" -d "{'owner':\"$id\"}" $host/cards/$card
|
|
||||||
done
|
|
||||||
curl -X DELETE -H "Content-Type: application/json" https://api.syui.ai/users/$id
|
|
||||||
|
|
||||||
## card select
|
|
||||||
echo "\ntest select card (no password)"
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":0,\"status\":\"normal\",\"cp\":1}" $host/cards
|
|
||||||
echo "\ntest get card (no password)"
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id}" $host/cards
|
|
||||||
#echo "\ntest get card (yes password)"
|
|
||||||
#curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"password\":\"$pass\"}" $host/cards
|
|
||||||
|
|
||||||
## create user
|
|
||||||
echo "\ntest create user (no password)"
|
|
||||||
curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"test\"}" $host/users
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,837 +0,0 @@
|
|||||||
// Code generated by ent, DO NOT EDIT.
|
|
||||||
|
|
||||||
package ogent
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"t/ent"
|
|
||||||
"t/ent/card"
|
|
||||||
"t/ent/group"
|
|
||||||
"t/ent/user"
|
|
||||||
|
|
||||||
"github.com/go-faster/jx"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
// origin-config
|
|
||||||
var password = os.Getenv("PASS")
|
|
||||||
var token = os.Getenv("TOKEN")
|
|
||||||
|
|
||||||
// OgentHandler implements the ogen generated Handler interface and uses Ent as data layer.
|
|
||||||
type OgentHandler struct {
|
|
||||||
client *ent.Client
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewOgentHandler returns a new OgentHandler.
|
|
||||||
func NewOgentHandler(c *ent.Client) *OgentHandler { return &OgentHandler{c} }
|
|
||||||
|
|
||||||
// rawError renders err as json string.
|
|
||||||
func rawError(err error) jx.Raw {
|
|
||||||
var e jx.Encoder
|
|
||||||
e.Str(err.Error())
|
|
||||||
return e.Bytes()
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateCard handles POST /cards requests.
|
|
||||||
func (h *OgentHandler) CreateCard(ctx context.Context, req *CreateCardReq) (CreateCardRes, error) {
|
|
||||||
b := h.client.Card.Create()
|
|
||||||
// Add all fields.
|
|
||||||
b.SetPassword(req.Password)
|
|
||||||
if v, ok := req.Card.Get(); ok {
|
|
||||||
b.SetCard(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Skill.Get(); ok {
|
|
||||||
b.SetSkill(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Status.Get(); ok {
|
|
||||||
b.SetStatus(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Cp.Get(); ok {
|
|
||||||
b.SetCp(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.URL.Get(); ok {
|
|
||||||
b.SetURL(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.CreatedAt.Get(); ok {
|
|
||||||
b.SetCreatedAt(v)
|
|
||||||
}
|
|
||||||
// Add all edges.
|
|
||||||
//b.SetOwnerID(req.Owner)
|
|
||||||
// origin-config
|
|
||||||
if req.Password == password {
|
|
||||||
b.SetOwnerID(req.Owner)
|
|
||||||
} else {
|
|
||||||
b.SetOwnerID(0)
|
|
||||||
}
|
|
||||||
// Persist to storage.
|
|
||||||
e, err := b.Save(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload the entity to attach all eager-loaded edges.
|
|
||||||
q := h.client.Card.Query().Where(card.ID(e.ID))
|
|
||||||
e, err = q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
// This should never happen.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return NewCardCreate(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadCard handles GET /cards/{id} requests.
|
|
||||||
func (h *OgentHandler) ReadCard(ctx context.Context, params ReadCardParams) (ReadCardRes, error) {
|
|
||||||
q := h.client.Card.Query().Where(card.IDEQ(params.ID))
|
|
||||||
e, err := q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NewCardRead(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateCard handles PATCH /cards/{id} requests.
|
|
||||||
func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, params UpdateCardParams) (UpdateCardRes, error) {
|
|
||||||
b := h.client.Card.UpdateOneID(params.ID)
|
|
||||||
if v, ok := req.Token.Get(); ok {
|
|
||||||
if v == token {
|
|
||||||
b.SetToken(v)
|
|
||||||
if v, ok := req.Skill.Get(); ok {
|
|
||||||
b.SetSkill(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Status.Get(); ok {
|
|
||||||
b.SetStatus(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Token.Get(); ok {
|
|
||||||
b.SetToken(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Cp.Get(); ok {
|
|
||||||
b.SetCp(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Owner.Get(); ok {
|
|
||||||
b.SetOwnerID(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Persist to storage.
|
|
||||||
e, err := b.Save(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload the entity to attach all eager-loaded edges.
|
|
||||||
q := h.client.Card.Query().Where(card.ID(e.ID))
|
|
||||||
e, err = q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
// This should never happen.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return NewCardUpdate(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteCard handles DELETE /cards/{id} requests.
|
|
||||||
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
|
|
||||||
err := h.client.Card.DeleteOneID(0).Exec(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new(DeleteCardNoContent), nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListCard handles GET /cards requests.
|
|
||||||
func (h *OgentHandler) ListCard(ctx context.Context, params ListCardParams) (ListCardRes, error) {
|
|
||||||
q := h.client.Card.Query()
|
|
||||||
page := 1
|
|
||||||
if v, ok := params.Page.Get(); ok {
|
|
||||||
page = v
|
|
||||||
}
|
|
||||||
itemsPerPage := 30
|
|
||||||
if v, ok := params.ItemsPerPage.Get(); ok {
|
|
||||||
itemsPerPage = v
|
|
||||||
}
|
|
||||||
q.Limit(itemsPerPage).Offset((page - 1) * itemsPerPage)
|
|
||||||
|
|
||||||
es, err := q.All(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r := NewCardLists(es)
|
|
||||||
return (*ListCardOKApplicationJSON)(&r), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadCardOwner handles GET /cards/{id}/owner requests.
|
|
||||||
func (h *OgentHandler) ReadCardOwner(ctx context.Context, params ReadCardOwnerParams) (ReadCardOwnerRes, error) {
|
|
||||||
q := h.client.Card.Query().Where(card.IDEQ(params.ID)).QueryOwner()
|
|
||||||
e, err := q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NewCardOwnerRead(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateGroup handles POST /groups requests.
|
|
||||||
func (h *OgentHandler) CreateGroup(ctx context.Context, req *CreateGroupReq) (CreateGroupRes, error) {
|
|
||||||
b := h.client.Group.Create()
|
|
||||||
// Add all fields.
|
|
||||||
b.SetName("")
|
|
||||||
b.SetPassword(req.Password)
|
|
||||||
// Add all edges.
|
|
||||||
b.AddUserIDs(req.Users...)
|
|
||||||
// Persist to storage.
|
|
||||||
e, err := b.Save(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload the entity to attach all eager-loaded edges.
|
|
||||||
q := h.client.Group.Query().Where(group.ID(e.ID))
|
|
||||||
e, err = q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
// This should never happen.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return NewGroupCreate(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadGroup handles GET /groups/{id} requests.
|
|
||||||
func (h *OgentHandler) ReadGroup(ctx context.Context, params ReadGroupParams) (ReadGroupRes, error) {
|
|
||||||
q := h.client.Group.Query().Where(group.IDEQ(params.ID))
|
|
||||||
e, err := q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NewGroupRead(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateGroup handles PATCH /groups/{id} requests.
|
|
||||||
func (h *OgentHandler) UpdateGroup(ctx context.Context, req *UpdateGroupReq, params UpdateGroupParams) (UpdateGroupRes, error) {
|
|
||||||
b := h.client.Group.UpdateOneID(0)
|
|
||||||
// Add all fields.
|
|
||||||
if v, ok := req.Name.Get(); ok {
|
|
||||||
b.SetName(v)
|
|
||||||
}
|
|
||||||
// Add all edges.
|
|
||||||
if req.Users != nil {
|
|
||||||
b.ClearUsers().AddUserIDs(req.Users...)
|
|
||||||
}
|
|
||||||
// Persist to storage.
|
|
||||||
e, err := b.Save(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload the entity to attach all eager-loaded edges.
|
|
||||||
q := h.client.Group.Query().Where(group.ID(e.ID))
|
|
||||||
e, err = q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
// This should never happen.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return NewGroupUpdate(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteGroup handles DELETE /groups/{id} requests.
|
|
||||||
func (h *OgentHandler) DeleteGroup(ctx context.Context, params DeleteGroupParams) (DeleteGroupRes, error) {
|
|
||||||
err := h.client.Group.DeleteOneID(0).Exec(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new(DeleteGroupNoContent), nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListGroup handles GET /groups requests.
|
|
||||||
func (h *OgentHandler) ListGroup(ctx context.Context, params ListGroupParams) (ListGroupRes, error) {
|
|
||||||
q := h.client.Group.Query()
|
|
||||||
page := 1
|
|
||||||
if v, ok := params.Page.Get(); ok {
|
|
||||||
page = v
|
|
||||||
}
|
|
||||||
itemsPerPage := 30
|
|
||||||
if v, ok := params.ItemsPerPage.Get(); ok {
|
|
||||||
itemsPerPage = v
|
|
||||||
}
|
|
||||||
q.Limit(itemsPerPage).Offset((page - 1) * itemsPerPage)
|
|
||||||
|
|
||||||
es, err := q.All(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r := NewGroupLists(es)
|
|
||||||
return (*ListGroupOKApplicationJSON)(&r), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListGroupUsers handles GET /groups/{id}/users requests.
|
|
||||||
func (h *OgentHandler) ListGroupUsers(ctx context.Context, params ListGroupUsersParams) (ListGroupUsersRes, error) {
|
|
||||||
q := h.client.Group.Query().Where(group.IDEQ(params.ID)).QueryUsers()
|
|
||||||
page := 1
|
|
||||||
if v, ok := params.Page.Get(); ok {
|
|
||||||
page = v
|
|
||||||
}
|
|
||||||
itemsPerPage := 30
|
|
||||||
if v, ok := params.ItemsPerPage.Get(); ok {
|
|
||||||
itemsPerPage = v
|
|
||||||
}
|
|
||||||
q.Limit(itemsPerPage).Offset((page - 1) * itemsPerPage)
|
|
||||||
es, err := q.All(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r := NewGroupUsersLists(es)
|
|
||||||
return (*ListGroupUsersOKApplicationJSON)(&r), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateUser handles POST /users requests.
|
|
||||||
func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (CreateUserRes, error) {
|
|
||||||
b := h.client.User.Create()
|
|
||||||
|
|
||||||
// Add all fields.
|
|
||||||
//b.SetUsername(req.Username)
|
|
||||||
//origin-config
|
|
||||||
if req.Password == password {
|
|
||||||
b.SetUsername(req.Username)
|
|
||||||
} else {
|
|
||||||
b.SetUsername("")
|
|
||||||
}
|
|
||||||
|
|
||||||
b.SetPassword(req.Password)
|
|
||||||
|
|
||||||
if v, ok := req.Fav.Get(); ok {
|
|
||||||
b.SetFav(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Did.Get(); ok {
|
|
||||||
b.SetDid(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Bsky.Get(); ok {
|
|
||||||
b.SetBsky(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Mastodon.Get(); ok {
|
|
||||||
b.SetMastodon(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
if v, ok := req.Delete.Get(); ok {
|
|
||||||
b.SetDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Handle.Get(); ok {
|
|
||||||
b.SetHandle(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Token.Get(); ok {
|
|
||||||
b.SetToken(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.CreatedAt.Get(); ok {
|
|
||||||
b.SetCreatedAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.UpdatedAt.Get(); ok {
|
|
||||||
b.SetUpdatedAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.RaidAt.Get(); ok {
|
|
||||||
b.SetRaidAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Luck.Get(); ok {
|
|
||||||
b.SetLuck(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Aiten.Get(); ok {
|
|
||||||
b.SetAiten(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LuckAt.Get(); ok {
|
|
||||||
b.SetLuckAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Like.Get(); ok {
|
|
||||||
b.SetLike(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeRank.Get(); ok {
|
|
||||||
b.SetLikeRank(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeAt.Get(); ok {
|
|
||||||
b.SetLikeAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Ten.Get(); ok {
|
|
||||||
b.SetTen(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenSu.Get(); ok {
|
|
||||||
b.SetTenSu(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenKai.Get(); ok {
|
|
||||||
b.SetTenKai(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenCard.Get(); ok {
|
|
||||||
b.SetTenCard(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenDelete.Get(); ok {
|
|
||||||
b.SetTenDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenPost.Get(); ok {
|
|
||||||
b.SetTenPost(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenGet.Get(); ok {
|
|
||||||
b.SetTenGet(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenAt.Get(); ok {
|
|
||||||
b.SetTenAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Next.Get(); ok {
|
|
||||||
b.SetNext(v)
|
|
||||||
}
|
|
||||||
// Add all edges.
|
|
||||||
b.AddCardIDs(req.Card...)
|
|
||||||
// Persist to storage.
|
|
||||||
e, err := b.Save(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload the entity to attach all eager-loaded edges.
|
|
||||||
q := h.client.User.Query().Where(user.ID(e.ID))
|
|
||||||
e, err = q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
// This should never happen.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return NewUserCreate(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReadUser handles GET /users/{id} requests.
|
|
||||||
func (h *OgentHandler) ReadUser(ctx context.Context, params ReadUserParams) (ReadUserRes, error) {
|
|
||||||
q := h.client.User.Query().Where(user.IDEQ(params.ID))
|
|
||||||
e, err := q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NewUserRead(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UpdateUser handles PATCH /users/{id} requests.
|
|
||||||
func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, params UpdateUserParams) (UpdateUserRes, error) {
|
|
||||||
b := h.client.User.UpdateOneID(params.ID)
|
|
||||||
|
|
||||||
if v, ok := req.Token.Get(); ok {
|
|
||||||
if v == token {
|
|
||||||
b.SetToken(v)
|
|
||||||
|
|
||||||
if v, ok := req.Fav.Get(); ok {
|
|
||||||
b.SetFav(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Did.Get(); ok {
|
|
||||||
b.SetDid(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Bsky.Get(); ok {
|
|
||||||
b.SetBsky(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Mastodon.Get(); ok {
|
|
||||||
b.SetMastodon(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Delete.Get(); ok {
|
|
||||||
b.SetDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Handle.Get(); ok {
|
|
||||||
b.SetHandle(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.UpdatedAt.Get(); ok {
|
|
||||||
b.SetUpdatedAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.RaidAt.Get(); ok {
|
|
||||||
b.SetRaidAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Aiten.Get(); ok {
|
|
||||||
b.SetAiten(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Luck.Get(); ok {
|
|
||||||
b.SetLuck(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LuckAt.Get(); ok {
|
|
||||||
b.SetLuckAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Like.Get(); ok {
|
|
||||||
b.SetLike(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeRank.Get(); ok {
|
|
||||||
b.SetLikeRank(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.LikeAt.Get(); ok {
|
|
||||||
b.SetLikeAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Ten.Get(); ok {
|
|
||||||
b.SetTen(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenSu.Get(); ok {
|
|
||||||
b.SetTenSu(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenKai.Get(); ok {
|
|
||||||
b.SetTenKai(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenCard.Get(); ok {
|
|
||||||
b.SetTenCard(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenDelete.Get(); ok {
|
|
||||||
b.SetTenDelete(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenPost.Get(); ok {
|
|
||||||
b.SetTenPost(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenGet.Get(); ok {
|
|
||||||
b.SetTenGet(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.TenAt.Get(); ok {
|
|
||||||
b.SetTenAt(v)
|
|
||||||
}
|
|
||||||
if v, ok := req.Next.Get(); ok {
|
|
||||||
b.SetNext(v)
|
|
||||||
}
|
|
||||||
// Add all edges.
|
|
||||||
if req.Card != nil {
|
|
||||||
b.ClearCard().AddCardIDs(req.Card...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Persist to storage.
|
|
||||||
e, err := b.Save(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Reload the entity to attach all eager-loaded edges.
|
|
||||||
q := h.client.User.Query().Where(user.ID(e.ID))
|
|
||||||
e, err = q.Only(ctx)
|
|
||||||
if err != nil {
|
|
||||||
// This should never happen.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return NewUserUpdate(e), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteUser handles DELETE /users/{id} requests.
|
|
||||||
func (h *OgentHandler) DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error) {
|
|
||||||
err := h.client.User.DeleteOneID(0).Exec(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsConstraintError(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new(DeleteUserNoContent), nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListUser handles GET /users requests.
|
|
||||||
func (h *OgentHandler) ListUser(ctx context.Context, params ListUserParams) (ListUserRes, error) {
|
|
||||||
q := h.client.User.Query()
|
|
||||||
page := 1
|
|
||||||
if v, ok := params.Page.Get(); ok {
|
|
||||||
page = v
|
|
||||||
}
|
|
||||||
itemsPerPage := 30
|
|
||||||
if v, ok := params.ItemsPerPage.Get(); ok {
|
|
||||||
itemsPerPage = v
|
|
||||||
}
|
|
||||||
q.Limit(itemsPerPage).Offset((page - 1) * itemsPerPage)
|
|
||||||
|
|
||||||
es, err := q.All(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r := NewUserLists(es)
|
|
||||||
return (*ListUserOKApplicationJSON)(&r), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListUserCard handles GET /users/{id}/card requests.
|
|
||||||
func (h *OgentHandler) ListUserCard(ctx context.Context, params ListUserCardParams) (ListUserCardRes, error) {
|
|
||||||
q := h.client.User.Query().Where(user.IDEQ(params.ID)).QueryCard()
|
|
||||||
page := 1
|
|
||||||
if v, ok := params.Page.Get(); ok {
|
|
||||||
page = v
|
|
||||||
}
|
|
||||||
itemsPerPage := 30
|
|
||||||
if v, ok := params.ItemsPerPage.Get(); ok {
|
|
||||||
itemsPerPage = v
|
|
||||||
}
|
|
||||||
q.Limit(itemsPerPage).Offset((page - 1) * itemsPerPage)
|
|
||||||
es, err := q.All(ctx)
|
|
||||||
if err != nil {
|
|
||||||
switch {
|
|
||||||
case ent.IsNotFound(err):
|
|
||||||
return &R404{
|
|
||||||
Code: http.StatusNotFound,
|
|
||||||
Status: http.StatusText(http.StatusNotFound),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
case ent.IsNotSingular(err):
|
|
||||||
return &R409{
|
|
||||||
Code: http.StatusConflict,
|
|
||||||
Status: http.StatusText(http.StatusConflict),
|
|
||||||
Errors: rawError(err),
|
|
||||||
}, nil
|
|
||||||
default:
|
|
||||||
// Let the server handle the error.
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r := NewUserCardLists(es)
|
|
||||||
return (*ListUserCardOKApplicationJSON)(&r), nil
|
|
||||||
}
|
|
24
tmp/t.zsh
24
tmp/t.zsh
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
host=https://api.syui.ai
|
|
||||||
uid=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
|
||||||
did=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .did`
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
|
||||||
card=36
|
|
||||||
cp=`echo $(($RANDOM % 1000 + 400))`
|
|
||||||
s=$(($RANDOM % 7))
|
|
||||||
if [ $s -eq 1 ];then
|
|
||||||
s=super
|
|
||||||
skill=post
|
|
||||||
plus=$(($RANDOM % 1000 + 300))
|
|
||||||
cp=$((cp + plus))
|
|
||||||
else
|
|
||||||
s=normal
|
|
||||||
skill=ten
|
|
||||||
fi
|
|
||||||
tmp=`curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$uid,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards`
|
|
||||||
|
|
||||||
card=`echo $tmp|jq -r .card`
|
|
||||||
cp=`echo $tmp|jq -r .cp`
|
|
||||||
body="[card]\nid : $card\ncp : $cp"
|
|
||||||
|
|
||||||
atr @ $did -p "`echo $body`"
|
|
75
tmp/test.zsh
75
tmp/test.zsh
@@ -1,75 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias date="/opt/homebrew/bin/gdate"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
u=ai
|
|
||||||
s=normal
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
|
||||||
host_users="$host/users?itemsPerPage=2550"
|
|
||||||
updated_at_n=`date --iso-8601=seconds -d '1 days ago'`
|
|
||||||
now_at=`date --iso-8601=seconds`
|
|
||||||
raid_at_n=`date --iso-8601=seconds -d '1 days ago'`
|
|
||||||
data=`curl -sL "$host_users"|jq .`
|
|
||||||
nd=`date +"%Y%m%d"`
|
|
||||||
card=0
|
|
||||||
cp=0
|
|
||||||
body="next[y]"
|
|
||||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$u\")"|jq -r .id`
|
|
||||||
echo $id
|
|
||||||
|
|
||||||
#echo no token
|
|
||||||
#curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"ten_su\": 1, \"luck_at\": \"$now_at\", \"ten_at\": \"$updated_at_n\"}" -s $host/users/$id
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo yes token
|
|
||||||
#echo $token
|
|
||||||
#curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"ten_su\": 1, \"luck_at\": \"$now_at\", \"ten_at\": \"$updated_at_n\",\"token\": \"$token\"}" -s $host/users/$id
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo account delete id no token
|
|
||||||
#curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":true}" -s $host/users/381
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo account delete id token
|
|
||||||
#curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":false,\"token\":\"$token\"}" -s $host/users/381
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo add card no pass
|
|
||||||
#curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp}" -sL $host/cards
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo add card no pass
|
|
||||||
#echo $id
|
|
||||||
#curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\"}" -sL $host/cards
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo add user
|
|
||||||
#curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"test\",\"did\":\"t\"}" -s "$host/users"
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo add user pass
|
|
||||||
#curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"test\",\"did\":\"t\",\"password\":\"$pass\"}" -s "$host/users"
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
|
|
||||||
#echo card draw no pass
|
|
||||||
#curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id}" -s $host/cards
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
||||||
#
|
|
||||||
#echo card draw ok pass
|
|
||||||
#curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"password\":\"$pass\"}" -s $host/cards
|
|
||||||
#echo $body
|
|
||||||
#read
|
|
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
username=$1
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
alias date="/opt/homebrew/bin/gdate"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
host=https://api.syui.ai
|
|
||||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
|
||||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
|
||||||
host_users="$host/users?itemsPerPage=255"
|
|
||||||
data=`curl -sL "$host_users"|jq .`
|
|
||||||
nd=`date +"%Y%m%d"`
|
|
||||||
nd=20230101
|
|
||||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
|
||||||
|
|
||||||
echo username did
|
|
||||||
read
|
|
||||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"did\":\"$2\",\"token\":\"$token\"}" -s $host/users/$id
|
|
Reference in New Issue
Block a user