diff --git a/infra/db/model.go b/infra/db/model.go index 31cc7c33..d46c13ad 100644 --- a/infra/db/model.go +++ b/infra/db/model.go @@ -66,7 +66,7 @@ type Provider struct { type User struct { ID uuid.UUID `gorm:"type:char(36); primaryKey"` // アプリの管理者かどうか - Privilege bool `gorm:"<-:create; not null"` // Do not update + Privilege bool `gorm:"not null"` State int IcalSecret string `gorm:"not null"` Provider Provider `gorm:"foreignKey:UserID; constraint:OnDelete:CASCADE;"` diff --git a/infra/db/user_test.go b/infra/db/user_test.go index 833e375b..5e0280f6 100644 --- a/infra/db/user_test.go +++ b/infra/db/user_test.go @@ -67,7 +67,7 @@ func Test_saveUser(t *testing.T) { assert.Equal("hoge2", token.AccessToken) }) - t.Run("Can't update privilege", func(t *testing.T) { + t.Run("Update privilege", func(t *testing.T) { u, err := getUser(r.db, user.ID) assert.NoError(err) assert.False(u.Privilege) @@ -80,7 +80,7 @@ func Test_saveUser(t *testing.T) { u, err = getUser(r.db, user.ID) assert.NoError(err) - assert.False(u.Privilege) + assert.True(u.Privilege) }) }