Browse Source

修复合并冲突

boweniac 2 months ago
parent
commit
a57474e588

+ 1 - 1
crontask/compute_statistic.go

@@ -188,7 +188,7 @@ func (l *CronTask) computeStatistic() {
 		}
 
 		LabelsCount := []custom_types.LabelDist{}
-		err := l.svcCtx.DB.LabelRelationship.Query().Where(labelrelationship.OrganizationIDEQ(orgID), labelrelationship.DeletedAtIsNil()).GroupBy(labelrelationship.FieldLabelID).Aggregate(ent.Count()).Scan(l.ctx, &LabelsCount)
+		err := l.svcCtx.DB.LabelRelationship.Query().Where(labelrelationship.OrganizationIDEQ(orgID)).GroupBy(labelrelationship.FieldLabelID).Aggregate(ent.Count()).Scan(l.ctx, &LabelsCount)
 		l.Errorf("save hour data error:%v \n", err)
 		LabelsCountSet[orgID] = LabelsCount
 

+ 16 - 18
ent/client.go

@@ -276,7 +276,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
 		EmployeeConfig:      NewEmployeeConfigClient(cfg),
 		Label:               NewLabelClient(cfg),
 		LabelRelationship:   NewLabelRelationshipClient(cfg),
-		LabelTagging:      NewLabelTaggingClient(cfg),
+		LabelTagging:        NewLabelTaggingClient(cfg),
 		Message:             NewMessageClient(cfg),
 		MessageRecords:      NewMessageRecordsClient(cfg),
 		Msg:                 NewMsgClient(cfg),
@@ -329,7 +329,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
 		EmployeeConfig:      NewEmployeeConfigClient(cfg),
 		Label:               NewLabelClient(cfg),
 		LabelRelationship:   NewLabelRelationshipClient(cfg),
-		LabelTagging:      NewLabelTaggingClient(cfg),
+		LabelTagging:        NewLabelTaggingClient(cfg),
 		Message:             NewMessageClient(cfg),
 		MessageRecords:      NewMessageRecordsClient(cfg),
 		Msg:                 NewMsgClient(cfg),
@@ -384,9 +384,9 @@ func (c *Client) Use(hooks ...Hook) {
 		c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
 		c.LabelRelationship, c.LabelTagging, c.Message, c.MessageRecords, c.Msg,
 		c.Server, c.SopNode, c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail,
-		c.UsageStatisticDay,
-		c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal, c.WorkExperience,
-		c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
+		c.UsageStatisticDay, c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal,
+		c.WorkExperience, c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard,
+		c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Use(hooks...)
 	}
@@ -400,9 +400,9 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
 		c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
 		c.LabelRelationship, c.LabelTagging, c.Message, c.MessageRecords, c.Msg,
 		c.Server, c.SopNode, c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail,
-		c.UsageStatisticDay,
-		c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal, c.WorkExperience,
-		c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
+		c.UsageStatisticDay, c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal,
+		c.WorkExperience, c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard,
+		c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Intercept(interceptors...)
 	}
@@ -2235,14 +2235,12 @@ func (c *LabelRelationshipClient) QueryLabels(lr *LabelRelationship) *LabelQuery
 
 // Hooks returns the client hooks.
 func (c *LabelRelationshipClient) Hooks() []Hook {
-	hooks := c.hooks.LabelRelationship
-	return append(hooks[:len(hooks):len(hooks)], labelrelationship.Hooks[:]...)
+	return c.hooks.LabelRelationship
 }
 
 // Interceptors returns the client interceptors.
 func (c *LabelRelationshipClient) Interceptors() []Interceptor {
-	inters := c.inters.LabelRelationship
-	return append(inters[:len(inters):len(inters)], labelrelationship.Interceptors[:]...)
+	return c.inters.LabelRelationship
 }
 
 func (c *LabelRelationshipClient) mutate(ctx context.Context, m *LabelRelationshipMutation) (Value, error) {
@@ -5464,17 +5462,17 @@ type (
 		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
 		Contact, Employee, EmployeeConfig, Label, LabelRelationship, LabelTagging,
 		Message, MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token,
-		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour, UsageStatisticMonth,
-		UsageTotal, WorkExperience, WpChatroom, WpChatroomMember, Wx, WxCard,
-		WxCardUser, WxCardVisit []ent.Hook
+		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour,
+		UsageStatisticMonth, UsageTotal, WorkExperience, WpChatroom, WpChatroomMember,
+		Wx, WxCard, WxCardUser, WxCardVisit []ent.Hook
 	}
 	inters struct {
 		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
 		Contact, Employee, EmployeeConfig, Label, LabelRelationship, LabelTagging,
 		Message, MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token,
-		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour, UsageStatisticMonth,
-		UsageTotal, WorkExperience, WpChatroom, WpChatroomMember, Wx, WxCard,
-		WxCardUser, WxCardVisit []ent.Interceptor
+		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour,
+		UsageStatisticMonth, UsageTotal, WorkExperience, WpChatroom, WpChatroomMember,
+		Wx, WxCard, WxCardUser, WxCardVisit []ent.Interceptor
 	}
 )
 

+ 1 - 1
ent/ent.go

@@ -118,7 +118,7 @@ func checkColumn(table, column string) error {
 			employeeconfig.Table:      employeeconfig.ValidColumn,
 			label.Table:               label.ValidColumn,
 			labelrelationship.Table:   labelrelationship.ValidColumn,
-			labeltagging.Table:      labeltagging.ValidColumn,
+			labeltagging.Table:        labeltagging.ValidColumn,
 			message.Table:             message.ValidColumn,
 			messagerecords.Table:      messagerecords.ValidColumn,
 			msg.Table:                 msg.ValidColumn,

+ 1 - 12
ent/labelrelationship.go

@@ -25,8 +25,6 @@ type LabelRelationship struct {
 	UpdatedAt time.Time `json:"updated_at,omitempty"`
 	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
 	Status uint8 `json:"status,omitempty"`
-	// Delete Time | 删除日期
-	DeletedAt time.Time `json:"deleted_at,omitempty"`
 	// 标签 ID
 	LabelID uint64 `json:"label_id,omitempty"`
 	// 联系人 ID
@@ -79,7 +77,7 @@ func (*LabelRelationship) scanValues(columns []string) ([]any, error) {
 		switch columns[i] {
 		case labelrelationship.FieldID, labelrelationship.FieldStatus, labelrelationship.FieldLabelID, labelrelationship.FieldContactID, labelrelationship.FieldOrganizationID:
 			values[i] = new(sql.NullInt64)
-		case labelrelationship.FieldCreatedAt, labelrelationship.FieldUpdatedAt, labelrelationship.FieldDeletedAt:
+		case labelrelationship.FieldCreatedAt, labelrelationship.FieldUpdatedAt:
 			values[i] = new(sql.NullTime)
 		default:
 			values[i] = new(sql.UnknownType)
@@ -120,12 +118,6 @@ func (lr *LabelRelationship) assignValues(columns []string, values []any) error
 			} else if value.Valid {
 				lr.Status = uint8(value.Int64)
 			}
-		case labelrelationship.FieldDeletedAt:
-			if value, ok := values[i].(*sql.NullTime); !ok {
-				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
-			} else if value.Valid {
-				lr.DeletedAt = value.Time
-			}
 		case labelrelationship.FieldLabelID:
 			if value, ok := values[i].(*sql.NullInt64); !ok {
 				return fmt.Errorf("unexpected type %T for field label_id", values[i])
@@ -199,9 +191,6 @@ func (lr *LabelRelationship) String() string {
 	builder.WriteString("status=")
 	builder.WriteString(fmt.Sprintf("%v", lr.Status))
 	builder.WriteString(", ")
-	builder.WriteString("deleted_at=")
-	builder.WriteString(lr.DeletedAt.Format(time.ANSIC))
-	builder.WriteString(", ")
 	builder.WriteString("label_id=")
 	builder.WriteString(fmt.Sprintf("%v", lr.LabelID))
 	builder.WriteString(", ")

+ 0 - 16
ent/labelrelationship/labelrelationship.go

@@ -5,7 +5,6 @@ package labelrelationship
 import (
 	"time"
 
-	"entgo.io/ent"
 	"entgo.io/ent/dialect/sql"
 	"entgo.io/ent/dialect/sql/sqlgraph"
 )
@@ -21,8 +20,6 @@ const (
 	FieldUpdatedAt = "updated_at"
 	// FieldStatus holds the string denoting the status field in the database.
 	FieldStatus = "status"
-	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
-	FieldDeletedAt = "deleted_at"
 	// FieldLabelID holds the string denoting the label_id field in the database.
 	FieldLabelID = "label_id"
 	// FieldContactID holds the string denoting the contact_id field in the database.
@@ -57,7 +54,6 @@ var Columns = []string{
 	FieldCreatedAt,
 	FieldUpdatedAt,
 	FieldStatus,
-	FieldDeletedAt,
 	FieldLabelID,
 	FieldContactID,
 	FieldOrganizationID,
@@ -73,14 +69,7 @@ func ValidColumn(column string) bool {
 	return false
 }
 
-// Note that the variables below are initialized by the runtime
-// package on the initialization of the application. Therefore,
-// it should be imported in the main as follows:
-//
-//	import _ "wechat-api/ent/runtime"
 var (
-	Hooks        [1]ent.Hook
-	Interceptors [1]ent.Interceptor
 	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
 	DefaultCreatedAt func() time.Time
 	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
@@ -120,11 +109,6 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldStatus, opts...).ToFunc()
 }
 
-// ByDeletedAt orders the results by the deleted_at field.
-func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
-	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
-}
-
 // ByLabelID orders the results by the label_id field.
 func ByLabelID(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldLabelID, opts...).ToFunc()

+ 0 - 55
ent/labelrelationship/where.go

@@ -70,11 +70,6 @@ func Status(v uint8) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldStatus, v))
 }
 
-// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
-func DeletedAt(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldEQ(FieldDeletedAt, v))
-}
-
 // LabelID applies equality check predicate on the "label_id" field. It's identical to LabelIDEQ.
 func LabelID(v uint64) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldLabelID, v))
@@ -220,56 +215,6 @@ func StatusNotNil() predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldNotNull(FieldStatus))
 }
 
-// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
-func DeletedAtEQ(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldEQ(FieldDeletedAt, v))
-}
-
-// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
-func DeletedAtNEQ(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNEQ(FieldDeletedAt, v))
-}
-
-// DeletedAtIn applies the In predicate on the "deleted_at" field.
-func DeletedAtIn(vs ...time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldIn(FieldDeletedAt, vs...))
-}
-
-// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
-func DeletedAtNotIn(vs ...time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNotIn(FieldDeletedAt, vs...))
-}
-
-// DeletedAtGT applies the GT predicate on the "deleted_at" field.
-func DeletedAtGT(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldGT(FieldDeletedAt, v))
-}
-
-// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
-func DeletedAtGTE(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldGTE(FieldDeletedAt, v))
-}
-
-// DeletedAtLT applies the LT predicate on the "deleted_at" field.
-func DeletedAtLT(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldLT(FieldDeletedAt, v))
-}
-
-// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
-func DeletedAtLTE(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldLTE(FieldDeletedAt, v))
-}
-
-// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
-func DeletedAtIsNil() predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldIsNull(FieldDeletedAt))
-}
-
-// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
-func DeletedAtNotNil() predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNotNull(FieldDeletedAt))
-}
-
 // LabelIDEQ applies the EQ predicate on the "label_id" field.
 func LabelIDEQ(v uint64) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldLabelID, v))

+ 2 - 89
ent/labelrelationship_create.go

@@ -66,20 +66,6 @@ func (lrc *LabelRelationshipCreate) SetNillableStatus(u *uint8) *LabelRelationsh
 	return lrc
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (lrc *LabelRelationshipCreate) SetDeletedAt(t time.Time) *LabelRelationshipCreate {
-	lrc.mutation.SetDeletedAt(t)
-	return lrc
-}
-
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
-func (lrc *LabelRelationshipCreate) SetNillableDeletedAt(t *time.Time) *LabelRelationshipCreate {
-	if t != nil {
-		lrc.SetDeletedAt(*t)
-	}
-	return lrc
-}
-
 // SetLabelID sets the "label_id" field.
 func (lrc *LabelRelationshipCreate) SetLabelID(u uint64) *LabelRelationshipCreate {
 	lrc.mutation.SetLabelID(u)
@@ -157,9 +143,7 @@ func (lrc *LabelRelationshipCreate) Mutation() *LabelRelationshipMutation {
 
 // Save creates the LabelRelationship in the database.
 func (lrc *LabelRelationshipCreate) Save(ctx context.Context) (*LabelRelationship, error) {
-	if err := lrc.defaults(); err != nil {
-		return nil, err
-	}
+	lrc.defaults()
 	return withHooks(ctx, lrc.sqlSave, lrc.mutation, lrc.hooks)
 }
 
@@ -186,18 +170,12 @@ func (lrc *LabelRelationshipCreate) ExecX(ctx context.Context) {
 }
 
 // defaults sets the default values of the builder before save.
-func (lrc *LabelRelationshipCreate) defaults() error {
+func (lrc *LabelRelationshipCreate) defaults() {
 	if _, ok := lrc.mutation.CreatedAt(); !ok {
-		if labelrelationship.DefaultCreatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.DefaultCreatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.DefaultCreatedAt()
 		lrc.mutation.SetCreatedAt(v)
 	}
 	if _, ok := lrc.mutation.UpdatedAt(); !ok {
-		if labelrelationship.DefaultUpdatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.DefaultUpdatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.DefaultUpdatedAt()
 		lrc.mutation.SetUpdatedAt(v)
 	}
@@ -217,7 +195,6 @@ func (lrc *LabelRelationshipCreate) defaults() error {
 		v := labelrelationship.DefaultOrganizationID
 		lrc.mutation.SetOrganizationID(v)
 	}
-	return nil
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -285,10 +262,6 @@ func (lrc *LabelRelationshipCreate) createSpec() (*LabelRelationship, *sqlgraph.
 		_spec.SetField(labelrelationship.FieldStatus, field.TypeUint8, value)
 		_node.Status = value
 	}
-	if value, ok := lrc.mutation.DeletedAt(); ok {
-		_spec.SetField(labelrelationship.FieldDeletedAt, field.TypeTime, value)
-		_node.DeletedAt = value
-	}
 	if value, ok := lrc.mutation.OrganizationID(); ok {
 		_spec.SetField(labelrelationship.FieldOrganizationID, field.TypeUint64, value)
 		_node.OrganizationID = value
@@ -415,24 +388,6 @@ func (u *LabelRelationshipUpsert) ClearStatus() *LabelRelationshipUpsert {
 	return u
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (u *LabelRelationshipUpsert) SetDeletedAt(v time.Time) *LabelRelationshipUpsert {
-	u.Set(labelrelationship.FieldDeletedAt, v)
-	return u
-}
-
-// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
-func (u *LabelRelationshipUpsert) UpdateDeletedAt() *LabelRelationshipUpsert {
-	u.SetExcluded(labelrelationship.FieldDeletedAt)
-	return u
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (u *LabelRelationshipUpsert) ClearDeletedAt() *LabelRelationshipUpsert {
-	u.SetNull(labelrelationship.FieldDeletedAt)
-	return u
-}
-
 // SetLabelID sets the "label_id" field.
 func (u *LabelRelationshipUpsert) SetLabelID(v uint64) *LabelRelationshipUpsert {
 	u.Set(labelrelationship.FieldLabelID, v)
@@ -574,27 +529,6 @@ func (u *LabelRelationshipUpsertOne) ClearStatus() *LabelRelationshipUpsertOne {
 	})
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (u *LabelRelationshipUpsertOne) SetDeletedAt(v time.Time) *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.SetDeletedAt(v)
-	})
-}
-
-// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
-func (u *LabelRelationshipUpsertOne) UpdateDeletedAt() *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.UpdateDeletedAt()
-	})
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (u *LabelRelationshipUpsertOne) ClearDeletedAt() *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.ClearDeletedAt()
-	})
-}
-
 // SetLabelID sets the "label_id" field.
 func (u *LabelRelationshipUpsertOne) SetLabelID(v uint64) *LabelRelationshipUpsertOne {
 	return u.Update(func(s *LabelRelationshipUpsert) {
@@ -910,27 +844,6 @@ func (u *LabelRelationshipUpsertBulk) ClearStatus() *LabelRelationshipUpsertBulk
 	})
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (u *LabelRelationshipUpsertBulk) SetDeletedAt(v time.Time) *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.SetDeletedAt(v)
-	})
-}
-
-// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
-func (u *LabelRelationshipUpsertBulk) UpdateDeletedAt() *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.UpdateDeletedAt()
-	})
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (u *LabelRelationshipUpsertBulk) ClearDeletedAt() *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.ClearDeletedAt()
-	})
-}
-
 // SetLabelID sets the "label_id" field.
 func (u *LabelRelationshipUpsertBulk) SetLabelID(v uint64) *LabelRelationshipUpsertBulk {
 	return u.Update(func(s *LabelRelationshipUpsert) {

+ 4 - 68
ent/labelrelationship_update.go

@@ -63,26 +63,6 @@ func (lru *LabelRelationshipUpdate) ClearStatus() *LabelRelationshipUpdate {
 	return lru
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (lru *LabelRelationshipUpdate) SetDeletedAt(t time.Time) *LabelRelationshipUpdate {
-	lru.mutation.SetDeletedAt(t)
-	return lru
-}
-
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
-func (lru *LabelRelationshipUpdate) SetNillableDeletedAt(t *time.Time) *LabelRelationshipUpdate {
-	if t != nil {
-		lru.SetDeletedAt(*t)
-	}
-	return lru
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (lru *LabelRelationshipUpdate) ClearDeletedAt() *LabelRelationshipUpdate {
-	lru.mutation.ClearDeletedAt()
-	return lru
-}
-
 // SetLabelID sets the "label_id" field.
 func (lru *LabelRelationshipUpdate) SetLabelID(u uint64) *LabelRelationshipUpdate {
 	lru.mutation.SetLabelID(u)
@@ -179,9 +159,7 @@ func (lru *LabelRelationshipUpdate) ClearLabels() *LabelRelationshipUpdate {
 
 // Save executes the query and returns the number of nodes affected by the update operation.
 func (lru *LabelRelationshipUpdate) Save(ctx context.Context) (int, error) {
-	if err := lru.defaults(); err != nil {
-		return 0, err
-	}
+	lru.defaults()
 	return withHooks(ctx, lru.sqlSave, lru.mutation, lru.hooks)
 }
 
@@ -208,15 +186,11 @@ func (lru *LabelRelationshipUpdate) ExecX(ctx context.Context) {
 }
 
 // defaults sets the default values of the builder before save.
-func (lru *LabelRelationshipUpdate) defaults() error {
+func (lru *LabelRelationshipUpdate) defaults() {
 	if _, ok := lru.mutation.UpdatedAt(); !ok {
-		if labelrelationship.UpdateDefaultUpdatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.UpdateDefaultUpdatedAt()
 		lru.mutation.SetUpdatedAt(v)
 	}
-	return nil
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -254,12 +228,6 @@ func (lru *LabelRelationshipUpdate) sqlSave(ctx context.Context) (n int, err err
 	if lru.mutation.StatusCleared() {
 		_spec.ClearField(labelrelationship.FieldStatus, field.TypeUint8)
 	}
-	if value, ok := lru.mutation.DeletedAt(); ok {
-		_spec.SetField(labelrelationship.FieldDeletedAt, field.TypeTime, value)
-	}
-	if lru.mutation.DeletedAtCleared() {
-		_spec.ClearField(labelrelationship.FieldDeletedAt, field.TypeTime)
-	}
 	if value, ok := lru.mutation.OrganizationID(); ok {
 		_spec.SetField(labelrelationship.FieldOrganizationID, field.TypeUint64, value)
 	}
@@ -380,26 +348,6 @@ func (lruo *LabelRelationshipUpdateOne) ClearStatus() *LabelRelationshipUpdateOn
 	return lruo
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (lruo *LabelRelationshipUpdateOne) SetDeletedAt(t time.Time) *LabelRelationshipUpdateOne {
-	lruo.mutation.SetDeletedAt(t)
-	return lruo
-}
-
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
-func (lruo *LabelRelationshipUpdateOne) SetNillableDeletedAt(t *time.Time) *LabelRelationshipUpdateOne {
-	if t != nil {
-		lruo.SetDeletedAt(*t)
-	}
-	return lruo
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (lruo *LabelRelationshipUpdateOne) ClearDeletedAt() *LabelRelationshipUpdateOne {
-	lruo.mutation.ClearDeletedAt()
-	return lruo
-}
-
 // SetLabelID sets the "label_id" field.
 func (lruo *LabelRelationshipUpdateOne) SetLabelID(u uint64) *LabelRelationshipUpdateOne {
 	lruo.mutation.SetLabelID(u)
@@ -509,9 +457,7 @@ func (lruo *LabelRelationshipUpdateOne) Select(field string, fields ...string) *
 
 // Save executes the query and returns the updated LabelRelationship entity.
 func (lruo *LabelRelationshipUpdateOne) Save(ctx context.Context) (*LabelRelationship, error) {
-	if err := lruo.defaults(); err != nil {
-		return nil, err
-	}
+	lruo.defaults()
 	return withHooks(ctx, lruo.sqlSave, lruo.mutation, lruo.hooks)
 }
 
@@ -538,15 +484,11 @@ func (lruo *LabelRelationshipUpdateOne) ExecX(ctx context.Context) {
 }
 
 // defaults sets the default values of the builder before save.
-func (lruo *LabelRelationshipUpdateOne) defaults() error {
+func (lruo *LabelRelationshipUpdateOne) defaults() {
 	if _, ok := lruo.mutation.UpdatedAt(); !ok {
-		if labelrelationship.UpdateDefaultUpdatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.UpdateDefaultUpdatedAt()
 		lruo.mutation.SetUpdatedAt(v)
 	}
-	return nil
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -601,12 +543,6 @@ func (lruo *LabelRelationshipUpdateOne) sqlSave(ctx context.Context) (_node *Lab
 	if lruo.mutation.StatusCleared() {
 		_spec.ClearField(labelrelationship.FieldStatus, field.TypeUint8)
 	}
-	if value, ok := lruo.mutation.DeletedAt(); ok {
-		_spec.SetField(labelrelationship.FieldDeletedAt, field.TypeTime, value)
-	}
-	if lruo.mutation.DeletedAtCleared() {
-		_spec.ClearField(labelrelationship.FieldDeletedAt, field.TypeTime)
-	}
 	if value, ok := lruo.mutation.OrganizationID(); ok {
 		_spec.SetField(labelrelationship.FieldOrganizationID, field.TypeUint64, value)
 	}

+ 4 - 5
ent/migrate/schema.go

@@ -350,7 +350,6 @@ var (
 		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
 		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
 		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
-		{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
 		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
 		{Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
 		{Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
@@ -363,13 +362,13 @@ var (
 		ForeignKeys: []*schema.ForeignKey{
 			{
 				Symbol:     "label_relationship_contact_contact_relationships",
-				Columns:    []*schema.Column{LabelRelationshipColumns[6]},
+				Columns:    []*schema.Column{LabelRelationshipColumns[5]},
 				RefColumns: []*schema.Column{ContactColumns[0]},
 				OnDelete:   schema.NoAction,
 			},
 			{
 				Symbol:     "label_relationship_label_label_relationships",
-				Columns:    []*schema.Column{LabelRelationshipColumns[7]},
+				Columns:    []*schema.Column{LabelRelationshipColumns[6]},
 				RefColumns: []*schema.Column{LabelColumns[0]},
 				OnDelete:   schema.NoAction,
 			},
@@ -378,12 +377,12 @@ var (
 			{
 				Name:    "labelrelationship_label_id",
 				Unique:  false,
-				Columns: []*schema.Column{LabelRelationshipColumns[7]},
+				Columns: []*schema.Column{LabelRelationshipColumns[6]},
 			},
 			{
 				Name:    "labelrelationship_contact_id",
 				Unique:  false,
-				Columns: []*schema.Column{LabelRelationshipColumns[6]},
+				Columns: []*schema.Column{LabelRelationshipColumns[5]},
 			},
 		},
 	}

+ 2 - 75
ent/mutation.go

@@ -70,7 +70,7 @@ const (
 	TypeEmployeeConfig      = "EmployeeConfig"
 	TypeLabel               = "Label"
 	TypeLabelRelationship   = "LabelRelationship"
-	TypeLabelTagging      = "LabelTagging"
+	TypeLabelTagging        = "LabelTagging"
 	TypeMessage             = "Message"
 	TypeMessageRecords      = "MessageRecords"
 	TypeMsg                 = "Msg"
@@ -13096,7 +13096,6 @@ type LabelRelationshipMutation struct {
 	updated_at         *time.Time
 	status             *uint8
 	addstatus          *int8
-	deleted_at         *time.Time
 	organization_id    *uint64
 	addorganization_id *int64
 	clearedFields      map[string]struct{}
@@ -13355,55 +13354,6 @@ func (m *LabelRelationshipMutation) ResetStatus() {
 	delete(m.clearedFields, labelrelationship.FieldStatus)
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (m *LabelRelationshipMutation) SetDeletedAt(t time.Time) {
-	m.deleted_at = &t
-}
-
-// DeletedAt returns the value of the "deleted_at" field in the mutation.
-func (m *LabelRelationshipMutation) DeletedAt() (r time.Time, exists bool) {
-	v := m.deleted_at
-	if v == nil {
-		return
-	}
-	return *v, true
-}
-
-// OldDeletedAt returns the old "deleted_at" field's value of the LabelRelationship entity.
-// If the LabelRelationship object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *LabelRelationshipMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
-	if !m.op.Is(OpUpdateOne) {
-		return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
-	}
-	if m.id == nil || m.oldValue == nil {
-		return v, errors.New("OldDeletedAt requires an ID field in the mutation")
-	}
-	oldValue, err := m.oldValue(ctx)
-	if err != nil {
-		return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
-	}
-	return oldValue.DeletedAt, nil
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (m *LabelRelationshipMutation) ClearDeletedAt() {
-	m.deleted_at = nil
-	m.clearedFields[labelrelationship.FieldDeletedAt] = struct{}{}
-}
-
-// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
-func (m *LabelRelationshipMutation) DeletedAtCleared() bool {
-	_, ok := m.clearedFields[labelrelationship.FieldDeletedAt]
-	return ok
-}
-
-// ResetDeletedAt resets all changes to the "deleted_at" field.
-func (m *LabelRelationshipMutation) ResetDeletedAt() {
-	m.deleted_at = nil
-	delete(m.clearedFields, labelrelationship.FieldDeletedAt)
-}
-
 // SetLabelID sets the "label_id" field.
 func (m *LabelRelationshipMutation) SetLabelID(u uint64) {
 	m.labels = &u
@@ -13660,7 +13610,7 @@ func (m *LabelRelationshipMutation) Type() string {
 // order to get all numeric fields that were incremented/decremented, call
 // AddedFields().
 func (m *LabelRelationshipMutation) Fields() []string {
-	fields := make([]string, 0, 7)
+	fields := make([]string, 0, 6)
 	if m.created_at != nil {
 		fields = append(fields, labelrelationship.FieldCreatedAt)
 	}
@@ -13670,9 +13620,6 @@ func (m *LabelRelationshipMutation) Fields() []string {
 	if m.status != nil {
 		fields = append(fields, labelrelationship.FieldStatus)
 	}
-	if m.deleted_at != nil {
-		fields = append(fields, labelrelationship.FieldDeletedAt)
-	}
 	if m.labels != nil {
 		fields = append(fields, labelrelationship.FieldLabelID)
 	}
@@ -13696,8 +13643,6 @@ func (m *LabelRelationshipMutation) Field(name string) (ent.Value, bool) {
 		return m.UpdatedAt()
 	case labelrelationship.FieldStatus:
 		return m.Status()
-	case labelrelationship.FieldDeletedAt:
-		return m.DeletedAt()
 	case labelrelationship.FieldLabelID:
 		return m.LabelID()
 	case labelrelationship.FieldContactID:
@@ -13719,8 +13664,6 @@ func (m *LabelRelationshipMutation) OldField(ctx context.Context, name string) (
 		return m.OldUpdatedAt(ctx)
 	case labelrelationship.FieldStatus:
 		return m.OldStatus(ctx)
-	case labelrelationship.FieldDeletedAt:
-		return m.OldDeletedAt(ctx)
 	case labelrelationship.FieldLabelID:
 		return m.OldLabelID(ctx)
 	case labelrelationship.FieldContactID:
@@ -13757,13 +13700,6 @@ func (m *LabelRelationshipMutation) SetField(name string, value ent.Value) error
 		}
 		m.SetStatus(v)
 		return nil
-	case labelrelationship.FieldDeletedAt:
-		v, ok := value.(time.Time)
-		if !ok {
-			return fmt.Errorf("unexpected type %T for field %s", value, name)
-		}
-		m.SetDeletedAt(v)
-		return nil
 	case labelrelationship.FieldLabelID:
 		v, ok := value.(uint64)
 		if !ok {
@@ -13845,9 +13781,6 @@ func (m *LabelRelationshipMutation) ClearedFields() []string {
 	if m.FieldCleared(labelrelationship.FieldStatus) {
 		fields = append(fields, labelrelationship.FieldStatus)
 	}
-	if m.FieldCleared(labelrelationship.FieldDeletedAt) {
-		fields = append(fields, labelrelationship.FieldDeletedAt)
-	}
 	if m.FieldCleared(labelrelationship.FieldOrganizationID) {
 		fields = append(fields, labelrelationship.FieldOrganizationID)
 	}
@@ -13868,9 +13801,6 @@ func (m *LabelRelationshipMutation) ClearField(name string) error {
 	case labelrelationship.FieldStatus:
 		m.ClearStatus()
 		return nil
-	case labelrelationship.FieldDeletedAt:
-		m.ClearDeletedAt()
-		return nil
 	case labelrelationship.FieldOrganizationID:
 		m.ClearOrganizationID()
 		return nil
@@ -13891,9 +13821,6 @@ func (m *LabelRelationshipMutation) ResetField(name string) error {
 	case labelrelationship.FieldStatus:
 		m.ResetStatus()
 		return nil
-	case labelrelationship.FieldDeletedAt:
-		m.ResetDeletedAt()
-		return nil
 	case labelrelationship.FieldLabelID:
 		m.ResetLabelID()
 		return nil

+ 0 - 4
ent/runtime/runtime.go

@@ -542,10 +542,6 @@ func init() {
 	// label.DefaultOrganizationID holds the default value on creation for the organization_id field.
 	label.DefaultOrganizationID = labelDescOrganizationID.Default.(uint64)
 	labelrelationshipMixin := schema.LabelRelationship{}.Mixin()
-	labelrelationshipMixinHooks2 := labelrelationshipMixin[2].Hooks()
-	labelrelationship.Hooks[0] = labelrelationshipMixinHooks2[0]
-	labelrelationshipMixinInters2 := labelrelationshipMixin[2].Interceptors()
-	labelrelationship.Interceptors[0] = labelrelationshipMixinInters2[0]
 	labelrelationshipMixinFields0 := labelrelationshipMixin[0].Fields()
 	_ = labelrelationshipMixinFields0
 	labelrelationshipMixinFields1 := labelrelationshipMixin[1].Fields()

+ 0 - 24
ent/set_not_nil.go

@@ -2936,30 +2936,6 @@ func (lr *LabelRelationshipCreate) SetNotNilStatus(value *uint8) *LabelRelations
 }
 
 // set field if value's pointer is not nil.
-func (lr *LabelRelationshipUpdate) SetNotNilDeletedAt(value *time.Time) *LabelRelationshipUpdate {
-	if value != nil {
-		return lr.SetDeletedAt(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
-func (lr *LabelRelationshipUpdateOne) SetNotNilDeletedAt(value *time.Time) *LabelRelationshipUpdateOne {
-	if value != nil {
-		return lr.SetDeletedAt(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
-func (lr *LabelRelationshipCreate) SetNotNilDeletedAt(value *time.Time) *LabelRelationshipCreate {
-	if value != nil {
-		return lr.SetDeletedAt(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
 func (lr *LabelRelationshipUpdate) SetNotNilLabelID(value *uint64) *LabelRelationshipUpdate {
 	if value != nil {
 		return lr.SetLabelID(*value)

+ 0 - 1
internal/logic/contact/get_contact_list_logic.go

@@ -58,7 +58,6 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
 			labelrelationship.HasLabelsWith(
 				label.IDIn(req.LabelIDs...),
 			),
-			labelrelationship.DeletedAtIsNil(),
 		))
 	}
 	if req.WxWxid != nil {

+ 0 - 1
internal/logic/label/delete_label_logic.go

@@ -38,7 +38,6 @@ func (l *DeleteLabelLogic) DeleteLabel(req *types.IDsReq) (*types.BaseMsgResp, e
 				label.IDIn(req.Ids...),
 			), // Filter by ID
 			labelrelationship.OrganizationID(organizationId), // Additional filter by organizationId
-			labelrelationship.DeletedAtIsNil(),
 			labelrelationship.HasContactsWith(
 				contact.OrganizationIDEQ(organizationId),
 				contact.DeletedAtIsNil(),

+ 1 - 2
internal/logic/sop_task/publish_sop_task_logic.go

@@ -93,8 +93,7 @@ func (l *PublishSopTaskLogic) PublishSopTask(req *types.IDReq) (resp *types.Base
 
 				for _, condition := range stage.ConditionList {
 					subPredicate := contact.HasContactRelationshipsWith(
-						labelrelationship.LabelIDIn(condition.LabelIdList...),
-						labelrelationship.DeletedAtIsNil())
+						labelrelationship.LabelIDIn(condition.LabelIdList...))
 					labelrelationship.OrganizationIDEQ(organizationId)
 					if condition.Equal == 2 {
 						subPredicate = contact.Not(subPredicate)

+ 8 - 8
internal/types/types.go

@@ -2984,6 +2984,14 @@ type MessageReq struct {
 	Text   *string `json:"text"`
 }
 
+// swagger:model ChatReq
+type ChatReq struct {
+	// 大模型生成内容
+	AvatarId *string `json:"avatar_id"`
+	UserId   *uint64 `json:"user_id"`
+	Text     *string `json:"text"`
+}
+
 // swagger:model DashboardInfo
 type DashboardInfo struct {
 	BaseIDInfo
@@ -3065,11 +3073,3 @@ type WxData struct {
 	TotalGroup      uint64  `json:"total_group"`
 	InteractionRate float32 `json:"interaction_rate"`
 }
-
-// swagger:model ChatReq
-type ChatReq struct {
-	// 大模型生成内容
-	AvatarId *string `json:"avatar_id"`
-	UserId   *uint64 `json:"user_id"`
-	Text     *string `json:"text"`
-}