refactor: rename repo fun-s as they always take id
This commit is contained in:
parent
440008ec64
commit
ae2d98fa1f
2 changed files with 4 additions and 4 deletions
|
@ -12,11 +12,11 @@ object ProfileRepository {
|
|||
),
|
||||
)
|
||||
|
||||
fun getById(id: UInt): Profile? {
|
||||
fun get(id: UInt): Profile? {
|
||||
return profiles.get(id)
|
||||
}
|
||||
|
||||
fun deleteById(id: UInt): Boolean {
|
||||
fun delete(id: UInt): Boolean {
|
||||
return profiles.remove(id) != null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ fun Application.configureRouting() {
|
|||
return@get
|
||||
}
|
||||
|
||||
val profile = ProfileRepository.getById(id)
|
||||
val profile = ProfileRepository.get(id)
|
||||
if (profile == null) {
|
||||
call.respond(HttpStatusCode.NotFound)
|
||||
return@get
|
||||
|
@ -39,7 +39,7 @@ fun Application.configureRouting() {
|
|||
return@delete
|
||||
}
|
||||
|
||||
if (!ProfileRepository.deleteById(id)) {
|
||||
if (!ProfileRepository.delete(id)) {
|
||||
call.respond(HttpStatusCode.NotFound)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.OK)
|
||||
|
|
Loading…
Reference in a new issue