features/working-on-scopes #13

Merged
jtom38 merged 28 commits from features/working-on-scopes into main 2024-04-04 15:31:54 -07:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit f159582d34 - Show all commits

View File

@ -22,7 +22,7 @@ type IUserTable interface {
Update(id int, entity domain.UserEntity) error
UpdatePassword(name, password string) error
CheckUserHash(name, password string) error
AddScope(name, scope string) error
UpdateScopes(name, scope string) error
}
// Creates a new instance of UserRepository with the bound sql
@ -66,8 +66,8 @@ func (ur UserRepository) Create(name, password, scope string) (int64, error) {
dt := time.Now()
queryBuilder := sqlbuilder.NewInsertBuilder()
queryBuilder.InsertInto("users")
queryBuilder.Cols("Name", "Hash", "LastUpdated", "CreatedAt")
queryBuilder.Values(name, string(hash), dt, dt)
queryBuilder.Cols("Name", "Hash", "LastUpdated", "CreatedAt", "Scopes")
queryBuilder.Values(name, string(hash), dt, dt, scope)
query, args := queryBuilder.Build()
_, err = ur.connection.Exec(query, args...)
@ -110,7 +110,7 @@ func (ur UserRepository) CheckUserHash(name, password string) error {
return nil
}
func (ur UserRepository) AddScope(name, scope string) error {
func (ur UserRepository) UpdateScopes(name, scope string) error {
builder := sqlbuilder.NewUpdateBuilder()
builder.Update("users")
builder.Set (