fix: some api bug
This commit is contained in:
@@ -4,6 +4,7 @@ package models
|
||||
|
||||
import (
|
||||
"juwan-backend/app/users/rpc/internal/models/schema"
|
||||
"juwan-backend/app/users/rpc/internal/models/userpreferences"
|
||||
"juwan-backend/app/users/rpc/internal/models/users"
|
||||
"time"
|
||||
)
|
||||
@@ -12,18 +13,62 @@ import (
|
||||
// (default values, validators, hooks and policies) and stitches it
|
||||
// to their package variables.
|
||||
func init() {
|
||||
userpreferencesFields := schema.UserPreferences{}.Fields()
|
||||
_ = userpreferencesFields
|
||||
// userpreferencesDescNotificationOrder is the schema descriptor for notification_order field.
|
||||
userpreferencesDescNotificationOrder := userpreferencesFields[1].Descriptor()
|
||||
// userpreferences.DefaultNotificationOrder holds the default value on creation for the notification_order field.
|
||||
userpreferences.DefaultNotificationOrder = userpreferencesDescNotificationOrder.Default.(bool)
|
||||
// userpreferencesDescNotificationCommunity is the schema descriptor for notification_community field.
|
||||
userpreferencesDescNotificationCommunity := userpreferencesFields[2].Descriptor()
|
||||
// userpreferences.DefaultNotificationCommunity holds the default value on creation for the notification_community field.
|
||||
userpreferences.DefaultNotificationCommunity = userpreferencesDescNotificationCommunity.Default.(bool)
|
||||
// userpreferencesDescNotificationSystem is the schema descriptor for notification_system field.
|
||||
userpreferencesDescNotificationSystem := userpreferencesFields[3].Descriptor()
|
||||
// userpreferences.DefaultNotificationSystem holds the default value on creation for the notification_system field.
|
||||
userpreferences.DefaultNotificationSystem = userpreferencesDescNotificationSystem.Default.(bool)
|
||||
// userpreferencesDescTheme is the schema descriptor for theme field.
|
||||
userpreferencesDescTheme := userpreferencesFields[4].Descriptor()
|
||||
// userpreferences.DefaultTheme holds the default value on creation for the theme field.
|
||||
userpreferences.DefaultTheme = userpreferencesDescTheme.Default.(string)
|
||||
// userpreferencesDescLanguage is the schema descriptor for language field.
|
||||
userpreferencesDescLanguage := userpreferencesFields[5].Descriptor()
|
||||
// userpreferences.DefaultLanguage holds the default value on creation for the language field.
|
||||
userpreferences.DefaultLanguage = userpreferencesDescLanguage.Default.(string)
|
||||
// userpreferencesDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
userpreferencesDescUpdatedAt := userpreferencesFields[6].Descriptor()
|
||||
// userpreferences.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
userpreferences.DefaultUpdatedAt = userpreferencesDescUpdatedAt.Default.(func() time.Time)
|
||||
usersFields := schema.Users{}.Fields()
|
||||
_ = usersFields
|
||||
// usersDescNickname is the schema descriptor for nickname field.
|
||||
usersDescNickname := usersFields[5].Descriptor()
|
||||
// users.DefaultNickname holds the default value on creation for the nickname field.
|
||||
users.DefaultNickname = usersDescNickname.Default.(string)
|
||||
// usersDescAvatar is the schema descriptor for avatar field.
|
||||
usersDescAvatar := usersFields[6].Descriptor()
|
||||
// users.DefaultAvatar holds the default value on creation for the avatar field.
|
||||
users.DefaultAvatar = usersDescAvatar.Default.(string)
|
||||
// usersDescBio is the schema descriptor for bio field.
|
||||
usersDescBio := usersFields[7].Descriptor()
|
||||
// users.DefaultBio holds the default value on creation for the bio field.
|
||||
users.DefaultBio = usersDescBio.Default.(string)
|
||||
// usersDescCurrentRole is the schema descriptor for current_role field.
|
||||
usersDescCurrentRole := usersFields[8].Descriptor()
|
||||
// users.DefaultCurrentRole holds the default value on creation for the current_role field.
|
||||
users.DefaultCurrentRole = usersDescCurrentRole.Default.(string)
|
||||
// users.CurrentRoleValidator is a validator for the "current_role" field. It is called by the builders before save.
|
||||
users.CurrentRoleValidator = usersDescCurrentRole.Validators[0].(func(string) error)
|
||||
// usersDescIsAdmin is the schema descriptor for is_admin field.
|
||||
usersDescIsAdmin := usersFields[11].Descriptor()
|
||||
usersDescIsAdmin := usersFields[10].Descriptor()
|
||||
// users.DefaultIsAdmin holds the default value on creation for the is_admin field.
|
||||
users.DefaultIsAdmin = usersDescIsAdmin.Default.(bool)
|
||||
// usersDescCreatedAt is the schema descriptor for created_at field.
|
||||
usersDescCreatedAt := usersFields[12].Descriptor()
|
||||
usersDescCreatedAt := usersFields[11].Descriptor()
|
||||
// users.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
users.DefaultCreatedAt = usersDescCreatedAt.Default.(func() time.Time)
|
||||
// usersDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
usersDescUpdatedAt := usersFields[13].Descriptor()
|
||||
usersDescUpdatedAt := usersFields[12].Descriptor()
|
||||
// users.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
users.DefaultUpdatedAt = usersDescUpdatedAt.Default.(func() time.Time)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user