From 14ff3fea9adef3530ce39610a83370fa7c67c488 Mon Sep 17 00:00:00 2001 From: lishuang Date: Sat, 13 May 2023 22:07:33 +0800 Subject: [PATCH] feat: ready to refine the space model. --- code/rest/matter_model.go | 2 +- code/rest/space_model.go | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/code/rest/matter_model.go b/code/rest/matter_model.go index aa91ce6..9318aaf 100644 --- a/code/rest/matter_model.go +++ b/code/rest/matter_model.go @@ -48,7 +48,7 @@ type Matter struct { VisitTime time.Time `json:"visitTime" gorm:"type:timestamp not null;default:'2018-01-01 00:00:00'"` Deleted bool `json:"deleted" gorm:"type:tinyint(1) not null;index:idx_matter_del;default:0"` DeleteTime time.Time `json:"deleteTime" gorm:"type:timestamp not null;index:idx_matter_delt;default:'2018-01-01 00:00:00'"` - SpaceUuid string `json:"spaceUuid" gorm:"type:char(36) not null;default:'root';index:idx_space_uuid"` + SpaceUuid string `json:"spaceUuid" gorm:"type:char(36) not null;index:idx_space_uuid"` Parent *Matter `json:"parent" gorm:"-"` Children []*Matter `json:"-" gorm:"-"` } diff --git a/code/rest/space_model.go b/code/rest/space_model.go index caaabc8..84062e8 100644 --- a/code/rest/space_model.go +++ b/code/rest/space_model.go @@ -8,10 +8,15 @@ import ( * shared space */ type Space struct { - Uuid string `json:"uuid" gorm:"type:char(36);primary_key;unique"` - Sort int64 `json:"sort" gorm:"type:bigint(20) not null"` - UpdateTime time.Time `json:"updateTime" gorm:"type:timestamp not null;default:CURRENT_TIMESTAMP"` - CreateTime time.Time `json:"createTime" gorm:"type:timestamp not null;default:'2018-01-01 00:00:00'"` - UserUuid string `json:"userUuid" gorm:"type:char(36);unique:uk_user_uuid"` - User *User `json:"user" gorm:"-"` + Uuid string `json:"uuid" gorm:"type:char(36);primary_key;unique"` + Sort int64 `json:"sort" gorm:"type:bigint(20) not null"` + UpdateTime time.Time `json:"updateTime" gorm:"type:timestamp not null;default:CURRENT_TIMESTAMP"` + CreateTime time.Time `json:"createTime" gorm:"type:timestamp not null;default:'2018-01-01 00:00:00'"` + Name string `json:"name" gorm:"type:varchar(100) not null;unique"` + UserUuid string `json:"userUuid" gorm:"type:char(36);index:idx_user_uuid"` + SizeLimit int64 `json:"sizeLimit" gorm:"type:bigint(20) not null;default:-1"` + TotalSizeLimit int64 `json:"totalSizeLimit" gorm:"type:bigint(20) not null;default:-1"` + TotalSize int64 `json:"totalSize" gorm:"type:bigint(20) not null;default:0"` + Type string `json:"type" gorm:"type:varchar(45)"` + User *User `json:"user" gorm:"-"` }