|
@@ -130,6 +130,9 @@ type AgentMutation struct {
|
|
|
token_agent map[uint64]struct{}
|
|
|
removedtoken_agent map[uint64]struct{}
|
|
|
clearedtoken_agent bool
|
|
|
+ wa_agent map[uint64]struct{}
|
|
|
+ removedwa_agent map[uint64]struct{}
|
|
|
+ clearedwa_agent bool
|
|
|
done bool
|
|
|
oldValue func(context.Context) (*Agent, error)
|
|
|
predicates []predicate.Agent
|
|
@@ -836,6 +839,60 @@ func (m *AgentMutation) ResetTokenAgent() {
|
|
|
m.removedtoken_agent = nil
|
|
|
}
|
|
|
|
|
|
+// AddWaAgentIDs adds the "wa_agent" edge to the Whatsapp entity by ids.
|
|
|
+func (m *AgentMutation) AddWaAgentIDs(ids ...uint64) {
|
|
|
+ if m.wa_agent == nil {
|
|
|
+ m.wa_agent = make(map[uint64]struct{})
|
|
|
+ }
|
|
|
+ for i := range ids {
|
|
|
+ m.wa_agent[ids[i]] = struct{}{}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// ClearWaAgent clears the "wa_agent" edge to the Whatsapp entity.
|
|
|
+func (m *AgentMutation) ClearWaAgent() {
|
|
|
+ m.clearedwa_agent = true
|
|
|
+}
|
|
|
+
|
|
|
+// WaAgentCleared reports if the "wa_agent" edge to the Whatsapp entity was cleared.
|
|
|
+func (m *AgentMutation) WaAgentCleared() bool {
|
|
|
+ return m.clearedwa_agent
|
|
|
+}
|
|
|
+
|
|
|
+// RemoveWaAgentIDs removes the "wa_agent" edge to the Whatsapp entity by IDs.
|
|
|
+func (m *AgentMutation) RemoveWaAgentIDs(ids ...uint64) {
|
|
|
+ if m.removedwa_agent == nil {
|
|
|
+ m.removedwa_agent = make(map[uint64]struct{})
|
|
|
+ }
|
|
|
+ for i := range ids {
|
|
|
+ delete(m.wa_agent, ids[i])
|
|
|
+ m.removedwa_agent[ids[i]] = struct{}{}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedWaAgent returns the removed IDs of the "wa_agent" edge to the Whatsapp entity.
|
|
|
+func (m *AgentMutation) RemovedWaAgentIDs() (ids []uint64) {
|
|
|
+ for id := range m.removedwa_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// WaAgentIDs returns the "wa_agent" edge IDs in the mutation.
|
|
|
+func (m *AgentMutation) WaAgentIDs() (ids []uint64) {
|
|
|
+ for id := range m.wa_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// ResetWaAgent resets all changes to the "wa_agent" edge.
|
|
|
+func (m *AgentMutation) ResetWaAgent() {
|
|
|
+ m.wa_agent = nil
|
|
|
+ m.clearedwa_agent = false
|
|
|
+ m.removedwa_agent = nil
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the AgentMutation builder.
|
|
|
func (m *AgentMutation) Where(ps ...predicate.Agent) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -1193,13 +1250,16 @@ func (m *AgentMutation) ResetField(name string) error {
|
|
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
func (m *AgentMutation) AddedEdges() []string {
|
|
|
- edges := make([]string, 0, 2)
|
|
|
+ edges := make([]string, 0, 3)
|
|
|
if m.wx_agent != nil {
|
|
|
edges = append(edges, agent.EdgeWxAgent)
|
|
|
}
|
|
|
if m.token_agent != nil {
|
|
|
edges = append(edges, agent.EdgeTokenAgent)
|
|
|
}
|
|
|
+ if m.wa_agent != nil {
|
|
|
+ edges = append(edges, agent.EdgeWaAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -1219,19 +1279,28 @@ func (m *AgentMutation) AddedIDs(name string) []ent.Value {
|
|
|
ids = append(ids, id)
|
|
|
}
|
|
|
return ids
|
|
|
+ case agent.EdgeWaAgent:
|
|
|
+ ids := make([]ent.Value, 0, len(m.wa_agent))
|
|
|
+ for id := range m.wa_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return ids
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
func (m *AgentMutation) RemovedEdges() []string {
|
|
|
- edges := make([]string, 0, 2)
|
|
|
+ edges := make([]string, 0, 3)
|
|
|
if m.removedwx_agent != nil {
|
|
|
edges = append(edges, agent.EdgeWxAgent)
|
|
|
}
|
|
|
if m.removedtoken_agent != nil {
|
|
|
edges = append(edges, agent.EdgeTokenAgent)
|
|
|
}
|
|
|
+ if m.removedwa_agent != nil {
|
|
|
+ edges = append(edges, agent.EdgeWaAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -1251,19 +1320,28 @@ func (m *AgentMutation) RemovedIDs(name string) []ent.Value {
|
|
|
ids = append(ids, id)
|
|
|
}
|
|
|
return ids
|
|
|
+ case agent.EdgeWaAgent:
|
|
|
+ ids := make([]ent.Value, 0, len(m.removedwa_agent))
|
|
|
+ for id := range m.removedwa_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return ids
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
func (m *AgentMutation) ClearedEdges() []string {
|
|
|
- edges := make([]string, 0, 2)
|
|
|
+ edges := make([]string, 0, 3)
|
|
|
if m.clearedwx_agent {
|
|
|
edges = append(edges, agent.EdgeWxAgent)
|
|
|
}
|
|
|
if m.clearedtoken_agent {
|
|
|
edges = append(edges, agent.EdgeTokenAgent)
|
|
|
}
|
|
|
+ if m.clearedwa_agent {
|
|
|
+ edges = append(edges, agent.EdgeWaAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -1275,6 +1353,8 @@ func (m *AgentMutation) EdgeCleared(name string) bool {
|
|
|
return m.clearedwx_agent
|
|
|
case agent.EdgeTokenAgent:
|
|
|
return m.clearedtoken_agent
|
|
|
+ case agent.EdgeWaAgent:
|
|
|
+ return m.clearedwa_agent
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
@@ -1297,6 +1377,9 @@ func (m *AgentMutation) ResetEdge(name string) error {
|
|
|
case agent.EdgeTokenAgent:
|
|
|
m.ResetTokenAgent()
|
|
|
return nil
|
|
|
+ case agent.EdgeWaAgent:
|
|
|
+ m.ResetWaAgent()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Agent edge %s", name)
|
|
|
}
|
|
@@ -36863,8 +36946,6 @@ type WhatsappMutation struct {
|
|
|
phone *string
|
|
|
organization_id *uint64
|
|
|
addorganization_id *int64
|
|
|
- agent_id *uint64
|
|
|
- addagent_id *int64
|
|
|
api_base *string
|
|
|
api_key *string
|
|
|
allow_list *[]string
|
|
@@ -36876,6 +36957,8 @@ type WhatsappMutation struct {
|
|
|
group_block_list *[]string
|
|
|
appendgroup_block_list []string
|
|
|
clearedFields map[string]struct{}
|
|
|
+ agent *uint64
|
|
|
+ clearedagent bool
|
|
|
done bool
|
|
|
oldValue func(context.Context) (*Whatsapp, error)
|
|
|
predicates []predicate.Whatsapp
|
|
@@ -37477,13 +37560,12 @@ func (m *WhatsappMutation) ResetOrganizationID() {
|
|
|
|
|
|
// SetAgentID sets the "agent_id" field.
|
|
|
func (m *WhatsappMutation) SetAgentID(u uint64) {
|
|
|
- m.agent_id = &u
|
|
|
- m.addagent_id = nil
|
|
|
+ m.agent = &u
|
|
|
}
|
|
|
|
|
|
// AgentID returns the value of the "agent_id" field in the mutation.
|
|
|
func (m *WhatsappMutation) AgentID() (r uint64, exists bool) {
|
|
|
- v := m.agent_id
|
|
|
+ v := m.agent
|
|
|
if v == nil {
|
|
|
return
|
|
|
}
|
|
@@ -37507,28 +37589,9 @@ func (m *WhatsappMutation) OldAgentID(ctx context.Context) (v uint64, err error)
|
|
|
return oldValue.AgentID, nil
|
|
|
}
|
|
|
|
|
|
-// AddAgentID adds u to the "agent_id" field.
|
|
|
-func (m *WhatsappMutation) AddAgentID(u int64) {
|
|
|
- if m.addagent_id != nil {
|
|
|
- *m.addagent_id += u
|
|
|
- } else {
|
|
|
- m.addagent_id = &u
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// AddedAgentID returns the value that was added to the "agent_id" field in this mutation.
|
|
|
-func (m *WhatsappMutation) AddedAgentID() (r int64, exists bool) {
|
|
|
- v := m.addagent_id
|
|
|
- if v == nil {
|
|
|
- return
|
|
|
- }
|
|
|
- return *v, true
|
|
|
-}
|
|
|
-
|
|
|
// ResetAgentID resets all changes to the "agent_id" field.
|
|
|
func (m *WhatsappMutation) ResetAgentID() {
|
|
|
- m.agent_id = nil
|
|
|
- m.addagent_id = nil
|
|
|
+ m.agent = nil
|
|
|
}
|
|
|
|
|
|
// SetAPIBase sets the "api_base" field.
|
|
@@ -37889,6 +37952,33 @@ func (m *WhatsappMutation) ResetGroupBlockList() {
|
|
|
delete(m.clearedFields, whatsapp.FieldGroupBlockList)
|
|
|
}
|
|
|
|
|
|
+// ClearAgent clears the "agent" edge to the Agent entity.
|
|
|
+func (m *WhatsappMutation) ClearAgent() {
|
|
|
+ m.clearedagent = true
|
|
|
+ m.clearedFields[whatsapp.FieldAgentID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// AgentCleared reports if the "agent" edge to the Agent entity was cleared.
|
|
|
+func (m *WhatsappMutation) AgentCleared() bool {
|
|
|
+ return m.clearedagent
|
|
|
+}
|
|
|
+
|
|
|
+// AgentIDs returns the "agent" edge IDs in the mutation.
|
|
|
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
|
|
+// AgentID instead. It exists only for internal usage by the builders.
|
|
|
+func (m *WhatsappMutation) AgentIDs() (ids []uint64) {
|
|
|
+ if id := m.agent; id != nil {
|
|
|
+ ids = append(ids, *id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAgent resets all changes to the "agent" edge.
|
|
|
+func (m *WhatsappMutation) ResetAgent() {
|
|
|
+ m.agent = nil
|
|
|
+ m.clearedagent = false
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the WhatsappMutation builder.
|
|
|
func (m *WhatsappMutation) Where(ps ...predicate.Whatsapp) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -37957,7 +38047,7 @@ func (m *WhatsappMutation) Fields() []string {
|
|
|
if m.organization_id != nil {
|
|
|
fields = append(fields, whatsapp.FieldOrganizationID)
|
|
|
}
|
|
|
- if m.agent_id != nil {
|
|
|
+ if m.agent != nil {
|
|
|
fields = append(fields, whatsapp.FieldAgentID)
|
|
|
}
|
|
|
if m.api_base != nil {
|
|
@@ -38216,9 +38306,6 @@ func (m *WhatsappMutation) AddedFields() []string {
|
|
|
if m.addorganization_id != nil {
|
|
|
fields = append(fields, whatsapp.FieldOrganizationID)
|
|
|
}
|
|
|
- if m.addagent_id != nil {
|
|
|
- fields = append(fields, whatsapp.FieldAgentID)
|
|
|
- }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -38231,8 +38318,6 @@ func (m *WhatsappMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
return m.AddedStatus()
|
|
|
case whatsapp.FieldOrganizationID:
|
|
|
return m.AddedOrganizationID()
|
|
|
- case whatsapp.FieldAgentID:
|
|
|
- return m.AddedAgentID()
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
@@ -38256,13 +38341,6 @@ func (m *WhatsappMutation) AddField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.AddOrganizationID(v)
|
|
|
return nil
|
|
|
- case whatsapp.FieldAgentID:
|
|
|
- v, ok := value.(int64)
|
|
|
- if !ok {
|
|
|
- return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
- }
|
|
|
- m.AddAgentID(v)
|
|
|
- return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Whatsapp numeric field %s", name)
|
|
|
}
|
|
@@ -38413,19 +38491,28 @@ func (m *WhatsappMutation) ResetField(name string) error {
|
|
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
func (m *WhatsappMutation) AddedEdges() []string {
|
|
|
- edges := make([]string, 0, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
+ if m.agent != nil {
|
|
|
+ edges = append(edges, whatsapp.EdgeAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
|
// name in this mutation.
|
|
|
func (m *WhatsappMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ switch name {
|
|
|
+ case whatsapp.EdgeAgent:
|
|
|
+ if id := m.agent; id != nil {
|
|
|
+ return []ent.Value{*id}
|
|
|
+ }
|
|
|
+ }
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
func (m *WhatsappMutation) RemovedEdges() []string {
|
|
|
- edges := make([]string, 0, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -38437,25 +38524,42 @@ func (m *WhatsappMutation) RemovedIDs(name string) []ent.Value {
|
|
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
func (m *WhatsappMutation) ClearedEdges() []string {
|
|
|
- edges := make([]string, 0, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
+ if m.clearedagent {
|
|
|
+ edges = append(edges, whatsapp.EdgeAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
|
// was cleared in this mutation.
|
|
|
func (m *WhatsappMutation) EdgeCleared(name string) bool {
|
|
|
+ switch name {
|
|
|
+ case whatsapp.EdgeAgent:
|
|
|
+ return m.clearedagent
|
|
|
+ }
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
// ClearEdge clears the value of the edge with the given name. It returns an error
|
|
|
// if that edge is not defined in the schema.
|
|
|
func (m *WhatsappMutation) ClearEdge(name string) error {
|
|
|
+ switch name {
|
|
|
+ case whatsapp.EdgeAgent:
|
|
|
+ m.ClearAgent()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
return fmt.Errorf("unknown Whatsapp unique edge %s", name)
|
|
|
}
|
|
|
|
|
|
// ResetEdge resets all changes to the edge with the given name in this mutation.
|
|
|
// It returns an error if the edge is not defined in the schema.
|
|
|
func (m *WhatsappMutation) ResetEdge(name string) error {
|
|
|
+ switch name {
|
|
|
+ case whatsapp.EdgeAgent:
|
|
|
+ m.ResetAgent()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
return fmt.Errorf("unknown Whatsapp edge %s", name)
|
|
|
}
|
|
|
|