|
@@ -2,27 +2,13 @@
|
|
|
|
|
|
package com.example.iplace.main.viewModel
|
|
|
|
|
|
-import android.content.Context
|
|
|
-import android.os.Bundle
|
|
|
import android.util.Log
|
|
|
-import android.widget.Toast
|
|
|
-import androidx.compose.runtime.MutableState
|
|
|
import androidx.compose.runtime.State
|
|
|
-import androidx.compose.runtime.derivedStateOf
|
|
|
-import androidx.compose.runtime.getValue
|
|
|
import androidx.compose.runtime.mutableStateOf
|
|
|
-import androidx.compose.runtime.remember
|
|
|
-import androidx.compose.runtime.setValue
|
|
|
-import androidx.core.os.bundleOf
|
|
|
-import androidx.lifecycle.LiveData
|
|
|
-import androidx.lifecycle.MutableLiveData
|
|
|
import androidx.lifecycle.ViewModel
|
|
|
-import androidx.lifecycle.ViewModelProvider
|
|
|
import androidx.lifecycle.viewModelScope
|
|
|
import androidx.navigation.NavHostController
|
|
|
-import com.example.iplace.R
|
|
|
import com.example.iplace.domain.Constants
|
|
|
-import com.example.iplace.model.Gender
|
|
|
import com.example.iplace.model.Place
|
|
|
import com.example.iplace.model.Users
|
|
|
import io.github.jan.supabase.annotations.SupabaseExperimental
|
|
@@ -31,13 +17,8 @@ import io.github.jan.supabase.gotrue.providers.builtin.Email
|
|
|
import io.github.jan.supabase.postgrest.from
|
|
|
import io.github.jan.supabase.postgrest.query.Columns
|
|
|
import io.github.jan.supabase.realtime.selectAsFlow
|
|
|
-import io.github.jan.supabase.supabaseJson
|
|
|
-import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.flow.MutableStateFlow
|
|
|
-import kotlinx.coroutines.flow.StateFlow
|
|
|
-import kotlinx.coroutines.flow.asStateFlow
|
|
|
import kotlinx.coroutines.launch
|
|
|
-import kotlinx.coroutines.withContext
|
|
|
|
|
|
class MainViewModel(): ViewModel() {
|
|
|
|
|
@@ -135,7 +116,6 @@ class MainViewModel(): ViewModel() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
suspend fun getPlaceList() = Constants.supabase.from("place")
|
|
|
.select()
|
|
|
.decodeList<Place>()
|
|
@@ -144,8 +124,7 @@ class MainViewModel(): ViewModel() {
|
|
|
fun getPlaceListRealTime() = Constants.supabase.from("Place")
|
|
|
.selectAsFlow(Place ::id_place)
|
|
|
|
|
|
-
|
|
|
- suspend fun getPlaceById(id: Int) = Constants.supabase.from("place")
|
|
|
+ suspend fun getPlaceById(id: String?) = Constants.supabase.from("place")
|
|
|
.select(columns = Columns.list("id_place","title","img_place","id_categoryFK","description","address","mapping","author")){
|
|
|
filter {
|
|
|
Place::id_place eq id
|