contact_field_template.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package schema
  2. import (
  3. "wechat-api/ent/custom_types"
  4. "wechat-api/ent/schema/localmixin"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/entsql"
  7. "entgo.io/ent/schema"
  8. "entgo.io/ent/schema/field"
  9. "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
  10. )
  11. type ContactFieldTemplate struct {
  12. ent.Schema
  13. }
  14. func (ContactFieldTemplate) Fields() []ent.Field {
  15. return []ent.Field{
  16. field.Uint64("organization_id").Default(1).
  17. Comment("机构 ID").
  18. Annotations(entsql.WithComments(true)),
  19. field.JSON("template", []custom_types.ContactFieldTemplate{}).
  20. Annotations(entsql.WithComments(true)).
  21. Comment("模板"),
  22. }
  23. }
  24. func (ContactFieldTemplate) Mixin() []ent.Mixin {
  25. return []ent.Mixin{
  26. mixins.IDMixin{},
  27. mixins.StatusMixin{},
  28. localmixin.SoftDeleteMixin{},
  29. }
  30. }
  31. func (ContactFieldTemplate) Indexes() []ent.Index {
  32. return []ent.Index{}
  33. }
  34. func (ContactFieldTemplate) Edges() []ent.Edge {
  35. return []ent.Edge{}
  36. }
  37. func (ContactFieldTemplate) Annotations() []schema.Annotation {
  38. return []schema.Annotation{
  39. entsql.WithComments(true),
  40. entsql.Annotation{Table: "contact_field_template"},
  41. }
  42. }