Skip to content

Instantly share code, notes, and snippets.

@ktutnik
Last active June 9, 2019 22:27
Show Gist options
  • Select an option

  • Save ktutnik/5d994fe19d14a101ab2e35c6ca996fe8 to your computer and use it in GitHub Desktop.

Select an option

Save ktutnik/5d994fe19d14a101ab2e35c6ca996fe8 to your computer and use it in GitHub Desktop.
export class UsersController {
// --------- other methods removed for clarity
@ownerOrAdmin()
@route.put(":id")
async modify(id: number, data: User) {
const password = await bcrypt.hash(data.password, 10)
return db("User").update({ ...data, password }).where({ id })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment