fix: some api bug
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"juwan-backend/app/shop/rpc/internal/models/predicate"
|
||||
"juwan-backend/app/shop/rpc/internal/models/schema"
|
||||
"juwan-backend/app/shop/rpc/internal/models/shopinvitations"
|
||||
"juwan-backend/app/shop/rpc/internal/models/shopplayers"
|
||||
"juwan-backend/app/shop/rpc/internal/models/shops"
|
||||
@@ -1437,8 +1438,7 @@ type ShopsMutation struct {
|
||||
allow_multi_shop *bool
|
||||
allow_independent_orders *bool
|
||||
dispatch_mode *string
|
||||
announcements *[]string
|
||||
appendannouncements []string
|
||||
announcements *schema.TextArray
|
||||
template_config *map[string]interface{}
|
||||
created_at *time.Time
|
||||
updated_at *time.Time
|
||||
@@ -2138,13 +2138,12 @@ func (m *ShopsMutation) ResetDispatchMode() {
|
||||
}
|
||||
|
||||
// SetAnnouncements sets the "announcements" field.
|
||||
func (m *ShopsMutation) SetAnnouncements(s []string) {
|
||||
m.announcements = &s
|
||||
m.appendannouncements = nil
|
||||
func (m *ShopsMutation) SetAnnouncements(sa schema.TextArray) {
|
||||
m.announcements = &sa
|
||||
}
|
||||
|
||||
// Announcements returns the value of the "announcements" field in the mutation.
|
||||
func (m *ShopsMutation) Announcements() (r []string, exists bool) {
|
||||
func (m *ShopsMutation) Announcements() (r schema.TextArray, exists bool) {
|
||||
v := m.announcements
|
||||
if v == nil {
|
||||
return
|
||||
@@ -2155,7 +2154,7 @@ func (m *ShopsMutation) Announcements() (r []string, exists bool) {
|
||||
// OldAnnouncements returns the old "announcements" field's value of the Shops entity.
|
||||
// If the Shops 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 *ShopsMutation) OldAnnouncements(ctx context.Context) (v []string, err error) {
|
||||
func (m *ShopsMutation) OldAnnouncements(ctx context.Context) (v schema.TextArray, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldAnnouncements is only allowed on UpdateOne operations")
|
||||
}
|
||||
@@ -2169,23 +2168,9 @@ func (m *ShopsMutation) OldAnnouncements(ctx context.Context) (v []string, err e
|
||||
return oldValue.Announcements, nil
|
||||
}
|
||||
|
||||
// AppendAnnouncements adds s to the "announcements" field.
|
||||
func (m *ShopsMutation) AppendAnnouncements(s []string) {
|
||||
m.appendannouncements = append(m.appendannouncements, s...)
|
||||
}
|
||||
|
||||
// AppendedAnnouncements returns the list of values that were appended to the "announcements" field in this mutation.
|
||||
func (m *ShopsMutation) AppendedAnnouncements() ([]string, bool) {
|
||||
if len(m.appendannouncements) == 0 {
|
||||
return nil, false
|
||||
}
|
||||
return m.appendannouncements, true
|
||||
}
|
||||
|
||||
// ClearAnnouncements clears the value of the "announcements" field.
|
||||
func (m *ShopsMutation) ClearAnnouncements() {
|
||||
m.announcements = nil
|
||||
m.appendannouncements = nil
|
||||
m.clearedFields[shops.FieldAnnouncements] = struct{}{}
|
||||
}
|
||||
|
||||
@@ -2198,7 +2183,6 @@ func (m *ShopsMutation) AnnouncementsCleared() bool {
|
||||
// ResetAnnouncements resets all changes to the "announcements" field.
|
||||
func (m *ShopsMutation) ResetAnnouncements() {
|
||||
m.announcements = nil
|
||||
m.appendannouncements = nil
|
||||
delete(m.clearedFields, shops.FieldAnnouncements)
|
||||
}
|
||||
|
||||
@@ -2581,7 +2565,7 @@ func (m *ShopsMutation) SetField(name string, value ent.Value) error {
|
||||
m.SetDispatchMode(v)
|
||||
return nil
|
||||
case shops.FieldAnnouncements:
|
||||
v, ok := value.([]string)
|
||||
v, ok := value.(schema.TextArray)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user