Skip to content

Commit

Permalink
Merge pull request #513 from traPtitech/fix/update-user-privilege
Browse files Browse the repository at this point in the history
🐛 enable to update user privilege
  • Loading branch information
ras0q authored Jan 5, 2024
2 parents a05162a + d39511f commit 7184525
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion infra/db/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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;"`
Expand Down
4 changes: 2 additions & 2 deletions infra/db/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
})
}

Expand Down

0 comments on commit 7184525

Please sign in to comment.