Промежуточное

This commit is contained in:
ElEgEv 2023-12-12 09:24:41 +04:00
parent 348e6a0b57
commit c9fb6f4f33
10 changed files with 7 additions and 6 deletions

View File

@ -3,9 +3,9 @@ package ru.ulstu.`is`.pmu.tank.api
object ApiRoutes { object ApiRoutes {
const val BASE = "http://10.0.2.2:8079/" const val BASE = "http://10.0.2.2:8079/"
const val USER = "users" const val USER = "users"
const val LEVEL = "level" const val LEVEL = "levels"
const val NATION = "nation" const val NATION = "nations"
const val TANK = "TANK" const val TANK = "tanks"
const val USER_TANK = "userTanks" const val USER_TANK = "userTanks"
const val NOT_USER_TANK = "notUserTanks" const val NOT_USER_TANK = "notUserTanks"
} }

View File

@ -78,7 +78,7 @@ interface ServerService {
@Query("_limit") limit: Int @Query("_limit") limit: Int
): List<NationRemote> ): List<NationRemote>
@GET(ApiRoutes.NATION) @GET("/getall/${ApiRoutes.NATION}")
suspend fun getAllNations(): List<NationRemote> suspend fun getAllNations(): List<NationRemote>
@GET("${ApiRoutes.NATION}/{id}") @GET("${ApiRoutes.NATION}/{id}")
@ -162,7 +162,7 @@ interface ServerService {
// ![USER_TANK_CROSS_REF] // ![USER_TANK_CROSS_REF]
companion object { companion object {
private const val BASE_URL = ApiRoutes.BASE private const val BASE_URL = "http://10.0.2.2:8079/"
@Volatile @Volatile
private var INSTANCE: ServerService? = null private var INSTANCE: ServerService? = null

View File

@ -32,6 +32,7 @@ class RestUserRepository(
override suspend fun insertUser(user: User) { override suspend fun insertUser(user: User) {
service.insertUser(user.toRemote()) service.insertUser(user.toRemote())
dbUserRepository.insertUser(user)
} }
override suspend fun updateUser(user: User) { override suspend fun updateUser(user: User) {

View File

@ -1,5 +1,5 @@
{ {
"name": "fake-db", "name": "20-db",
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"start": "json-server --watch data.json --host 0.0.0.0 -p 8079" "start": "json-server --watch data.json --host 0.0.0.0 -p 8079"