From 3567ac170adbccbaca6e00402267f2a9167e9ea5 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Fri, 17 Jan 2025 22:02:33 +0800 Subject: [PATCH] set name column length to 64 --- pkg/models/account.go | 6 +++--- pkg/models/transaction_category.go | 8 ++++---- pkg/models/transaction_tag.go | 6 +++--- pkg/models/transaction_template.go | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/models/account.go b/pkg/models/account.go index 03f9e0c0..6d1b0fc4 100644 --- a/pkg/models/account.go +++ b/pkg/models/account.go @@ -64,7 +64,7 @@ type Account struct { Category AccountCategory `xorm:"NOT NULL"` Type AccountType `xorm:"NOT NULL"` ParentAccountId int64 `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"` - Name string `xorm:"VARCHAR(32) NOT NULL"` + Name string `xorm:"VARCHAR(64) NOT NULL"` DisplayOrder int32 `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"` Icon int64 `xorm:"NOT NULL"` Color string `xorm:"VARCHAR(6) NOT NULL"` @@ -85,7 +85,7 @@ type AccountExtend struct { // AccountCreateRequest represents all parameters of account creation request type AccountCreateRequest struct { - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` Category AccountCategory `json:"category" binding:"required"` Type AccountType `json:"type" binding:"required"` Icon int64 `json:"icon,string" binding:"required,min=1"` @@ -102,7 +102,7 @@ type AccountCreateRequest struct { // AccountModifyRequest represents all parameters of account modification request type AccountModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` Category AccountCategory `json:"category" binding:"required"` Icon int64 `json:"icon,string" binding:"min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` diff --git a/pkg/models/transaction_category.go b/pkg/models/transaction_category.go index 34f7d895..c54e67ce 100644 --- a/pkg/models/transaction_category.go +++ b/pkg/models/transaction_category.go @@ -20,7 +20,7 @@ type TransactionCategory struct { Deleted bool `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` Type TransactionCategoryType `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` ParentCategoryId int64 `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` - Name string `xorm:"VARCHAR(32) NOT NULL"` + Name string `xorm:"VARCHAR(64) NOT NULL"` DisplayOrder int32 `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"` Icon int64 `xorm:"NOT NULL"` Color string `xorm:"VARCHAR(6) NOT NULL"` @@ -44,7 +44,7 @@ type TransactionCategoryGetRequest struct { // TransactionCategoryCreateRequest represents all parameters of single transaction category creation request type TransactionCategoryCreateRequest struct { - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` Type TransactionCategoryType `json:"type" binding:"required"` ParentId int64 `json:"parentId,string" binding:"min=0"` Icon int64 `json:"icon,string" binding:"min=1"` @@ -60,7 +60,7 @@ type TransactionCategoryCreateBatchRequest struct { // TransactionCategoryCreateWithSubCategories represents all parameters of multi transaction categories creation request type TransactionCategoryCreateWithSubCategories struct { - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` Type TransactionCategoryType `json:"type" binding:"required"` Icon int64 `json:"icon,string" binding:"min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` @@ -71,7 +71,7 @@ type TransactionCategoryCreateWithSubCategories struct { // TransactionCategoryModifyRequest represents all parameters of transaction category modification request type TransactionCategoryModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` ParentId int64 `json:"parentId,string" binding:"min=0"` Icon int64 `json:"icon,string" binding:"min=1"` Color string `json:"color" binding:"required,len=6,validHexRGBColor"` diff --git a/pkg/models/transaction_tag.go b/pkg/models/transaction_tag.go index 654905dc..9369fe76 100644 --- a/pkg/models/transaction_tag.go +++ b/pkg/models/transaction_tag.go @@ -5,7 +5,7 @@ type TransactionTag struct { TagId int64 `xorm:"PK"` Uid int64 `xorm:"INDEX(IDX_tag_uid_deleted_order) NOT NULL"` Deleted bool `xorm:"INDEX(IDX_tag_uid_deleted_order) NOT NULL"` - Name string `xorm:"VARCHAR(32) NOT NULL"` + Name string `xorm:"VARCHAR(64) NOT NULL"` DisplayOrder int32 `xorm:"INDEX(IDX_tag_uid_deleted_order) NOT NULL"` Hidden bool `xorm:"NOT NULL"` CreatedUnixTime int64 @@ -20,13 +20,13 @@ type TransactionTagGetRequest struct { // TransactionTagCreateRequest represents all parameters of transaction tag creation request type TransactionTagCreateRequest struct { - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` } // TransactionTagModifyRequest represents all parameters of transaction tag modification request type TransactionTagModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` } // TransactionTagHideRequest represents all parameters of transaction tag hiding request diff --git a/pkg/models/transaction_template.go b/pkg/models/transaction_template.go index 0c690fd3..b6375e10 100644 --- a/pkg/models/transaction_template.go +++ b/pkg/models/transaction_template.go @@ -31,7 +31,7 @@ type TransactionTemplate struct { Uid int64 `xorm:"INDEX(IDX_transaction_template_uid_deleted_template_type_order) NOT NULL"` Deleted bool `xorm:"INDEX(IDX_transaction_template_uid_deleted_template_type_order) INDEX(IDX_transaction_template_deleted_type_freqtype_scheduled_at) NOT NULL"` TemplateType TransactionTemplateType `xorm:"INDEX(IDX_transaction_template_uid_deleted_template_type_order) INDEX(IDX_transaction_template_deleted_type_freqtype_scheduled_at) NOT NULL"` - Name string `xorm:"VARCHAR(32) NOT NULL"` + Name string `xorm:"VARCHAR(64) NOT NULL"` Type TransactionType `xorm:"NOT NULL"` CategoryId int64 `xorm:"NOT NULL"` AccountId int64 `xorm:"NOT NULL"` @@ -65,7 +65,7 @@ type TransactionTemplateGetRequest struct { // TransactionTemplateCreateRequest represents all parameters of transaction template creation request type TransactionTemplateCreateRequest struct { TemplateType TransactionTemplateType `json:"templateType"` - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` Type TransactionType `json:"type" binding:"required"` CategoryId int64 `json:"categoryId,string" binding:"required,min=1"` SourceAccountId int64 `json:"sourceAccountId,string" binding:"required,min=1"` @@ -84,13 +84,13 @@ type TransactionTemplateCreateRequest struct { // TransactionTemplateModifyNameRequest represents all parameters of transaction template name modification request type TransactionTemplateModifyNameRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` } // TransactionTemplateModifyRequest represents all parameters of transaction template modification request type TransactionTemplateModifyRequest struct { Id int64 `json:"id,string" binding:"required,min=1"` - Name string `json:"name" binding:"required,notBlank,max=32"` + Name string `json:"name" binding:"required,notBlank,max=64"` Type TransactionType `json:"type" binding:"required"` CategoryId int64 `json:"categoryId,string" binding:"required,min=1"` SourceAccountId int64 `json:"sourceAccountId,string" binding:"required,min=1"`