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)
|
return profiles.get(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteById(id: UInt): Boolean {
|
fun delete(id: UInt): Boolean {
|
||||||
return profiles.remove(id) != null
|
return profiles.remove(id) != null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ fun Application.configureRouting() {
|
||||||
return@get
|
return@get
|
||||||
}
|
}
|
||||||
|
|
||||||
val profile = ProfileRepository.getById(id)
|
val profile = ProfileRepository.get(id)
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
call.respond(HttpStatusCode.NotFound)
|
call.respond(HttpStatusCode.NotFound)
|
||||||
return@get
|
return@get
|
||||||
|
@ -39,7 +39,7 @@ fun Application.configureRouting() {
|
||||||
return@delete
|
return@delete
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ProfileRepository.deleteById(id)) {
|
if (!ProfileRepository.delete(id)) {
|
||||||
call.respond(HttpStatusCode.NotFound)
|
call.respond(HttpStatusCode.NotFound)
|
||||||
} else {
|
} else {
|
||||||
call.respond(HttpStatusCode.OK)
|
call.respond(HttpStatusCode.OK)
|
||||||
|
|
Loading…
Add table
Reference in a new issue