Skip to content

Commit

Permalink
Merge pull request #265 from boostcampwm2023/main
Browse files Browse the repository at this point in the history
develop/aos 업데이트
  • Loading branch information
plashdof authored Jan 26, 2024
2 parents 0f94bcd + 434eb2a commit 15a52c7
Show file tree
Hide file tree
Showing 134 changed files with 2,596 additions and 487 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/be-autodeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: auto deploy

on:
push:
branches:
- develop/be


jobs:
push_to_registry:
name: Push to ncp container registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to NCP Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- name: Create config file
run: |
echo "export const awsConfig = ${OBJECT_STORAGE_CONFIG}" > ./be/objectStorage.config.ts
env:
OBJECT_STORAGE_CONFIG: ${{ secrets.OBJECT_STORAGE_CONFIG }}

- name: Create TypeORM config
run: |
mkdir -p ./be/src/configs
echo "import { TypeOrmModuleOptions } from '@nestjs/typeorm';" > ./be/src/configs/typeorm.config.ts
echo "export const typeORMConfig: TypeOrmModuleOptions = ${TYPEORM_CONFIG}" >> ./be/src/configs/typeorm.config.ts
env:
TYPEORM_CONFIG: ${{ secrets.TYPEORM_CONFIG }}

- name: build and push
uses: docker/build-push-action@v3
with:
context: ./be
file: ./be/Dockerfile
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/nibobnebob:latest
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/nibobnebob:latest
cache-to: type=inline





pull_from_registry:
name: Connect server ssh and pull from container registry
needs: push_to_registry
runs-on: ubuntu-latest
steps:
- name: connect ssh to Nginx server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NGINX_HOST }}
username: ${{ secrets.NGINX_USERNAME }}
password: ${{ secrets.NGINX_PASSWORD }}
port: ${{ secrets.NGINX_PORT }}
script: |
ssh ${{ secrets.DEV_USERNAME }}@${{ secrets.DEV_HOST }} <<- 'EOSSH'
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/nibobnebob
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker run -d -p 8000:8000 -e API_KEY=${{ secrets.DEV_APIKEY }} -e NODE_ENV="DEV" ${{ secrets.NCP_CONTAINER_REGISTRY }}/nibobnebob
docker image prune -f
EOSSH
2 changes: 1 addition & 1 deletion Aos/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ android {
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "0.1.0"
versionName = "1.0.3"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "NAVER_LOGIN_CLIENT_ID", getProperty("naverLoginClientId"))
Expand Down
3 changes: 2 additions & 1 deletion Aos/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
</activity>
<activity
android:name=".presentation.ui.intro.IntroActivity"
android:exported="false">
android:exported="false"
android:windowSoftInputMode="adjustPan">
</activity>
<activity
android:name=".presentation.ui.splash.SplashActivity"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data class MyRestaurantItem(
@SerializedName("restaurant_address") val address: String,
@SerializedName("restaurant_category") val category: String,
@SerializedName("restaurant_id") val id: Int,
@SerializedName("created_at") val createdAt: String,
@SerializedName("created_at") val createdAt: String?,
@SerializedName("restaurant_location") val location: Location,
@SerializedName("restaurant_name") val name: String,
@SerializedName("restaurant_phoneNumber") val phoneNumber: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ data class RecommendFollowListResponse(
val region: String,
@SerializedName("isFollow")
val isFollow: Boolean,
@SerializedName("profileImage")
@SerializedName("user_profileImage")
val profileImage: String
): BaseDataModel {
) : BaseDataModel {
companion object : DomainMapper<RecommendFollowListResponse, RecommendFollowListData> {
override fun RecommendFollowListResponse.toDomainModel(): RecommendFollowListData = RecommendFollowListData(
nickName = nickName,
region = region,
isFollow = isFollow,
profileImage = profileImage
)
override fun RecommendFollowListResponse.toDomainModel(): RecommendFollowListData =
RecommendFollowListData(
nickName = nickName,
region = region,
isFollow = isFollow,
profileImage = profileImage
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ interface RestaurantApi {
// 내 맛집 리스트
@GET("api/user/restaurant")
suspend fun myRestaurantList(
@Query("longitude") longitude: String? = null,
@Query("latitude") latitude: String? = null,
@Query("limit") limit: Int? = null,
@Query("page") page: Int? = null,
@Query("sort") sort: String? = null,
Expand Down Expand Up @@ -119,6 +121,7 @@ interface RestaurantApi {
//위치기반 맛집 리스트
@GET("api/restaurant/all")
suspend fun nearRestaurantList(
@Query("limit") limit : Int?,
@Query("radius") radius: String,
@Query("longitude") longitude: String,
@Query("latitude") latitude: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import com.avengers.nibobnebob.data.model.response.WishRestaurantResponse.Compan
import com.avengers.nibobnebob.data.model.runRemote
import com.avengers.nibobnebob.data.remote.RestaurantApi
import com.avengers.nibobnebob.domain.model.MyRestaurantData
import com.avengers.nibobnebob.domain.model.RecommendRestaurantData
import com.avengers.nibobnebob.domain.model.RestaurantDetailData
import com.avengers.nibobnebob.domain.model.RestaurantIsWishData
import com.avengers.nibobnebob.domain.model.RestaurantItemsData
import com.avengers.nibobnebob.domain.model.ReviewSortData
import com.avengers.nibobnebob.domain.model.SearchRestaurantData
import com.avengers.nibobnebob.domain.model.WishRestaurantData
import com.avengers.nibobnebob.domain.model.base.BaseState
import com.avengers.nibobnebob.domain.model.RecommendRestaurantData
import com.avengers.nibobnebob.domain.model.base.StatusCode
import com.avengers.nibobnebob.domain.repository.RestaurantRepository
import kotlinx.coroutines.flow.Flow
Expand Down Expand Up @@ -140,12 +140,15 @@ class RestaurantRepositoryImpl @Inject constructor(
}

override fun myRestaurantList(
longitude: String?,
latitude: String?,
limit: Int?,
page: Int?,
sort: String?
): Flow<BaseState<MyRestaurantData>> =
flow {
when (val result = runRemote { api.myRestaurantList(limit, page, sort) }) {
when (val result =
runRemote { api.myRestaurantList(longitude, latitude, limit, page, sort) }) {
is BaseState.Success -> {
result.data.body?.let { body ->
emit(BaseState.Success(body.toDomainModel()))
Expand Down Expand Up @@ -268,10 +271,11 @@ class RestaurantRepositoryImpl @Inject constructor(
override fun nearRestaurantList(
radius: String,
longitude: String,
latitude: String
latitude: String,
limit: Int?
): Flow<BaseState<List<RestaurantItemsData>>> = flow {

when (val result = runRemote { api.nearRestaurantList(radius, longitude, latitude) }) {
when (val result =
runRemote { api.nearRestaurantList(limit, radius, longitude, latitude) }) {
is BaseState.Success -> {
result.data.body?.let { body ->
emit(BaseState.Success(body.map { it.toDomainModel() }))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class MyRestaurantItemData(
val address: String,
val category: String,
val id: Int,
val createdAt : String,
val createdAt: String?,
val location: LocationData,
val name: String,
val phoneNumber: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ interface RestaurantRepository {
): Flow<BaseState<Unit>>

fun myRestaurantList(
longitude: String? = null,
latitude: String? = null,
limit: Int? = null,
page: Int? = null,
sort: String? = null
Expand Down Expand Up @@ -82,6 +84,7 @@ interface RestaurantRepository {
radius: String,
longitude: String,
latitude: String,
limit: Int?
): Flow<BaseState<List<RestaurantItemsData>>>

fun likeReview(reviewId: Int): Flow<BaseState<Unit>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ class GetMyRestaurantListUseCase @Inject constructor(
private val repository: RestaurantRepository
) {
operator fun invoke(
longitude: String? = null,
latitude: String? = null,
limit: Int? = null,
page: Int? = null,
sort: String? = null,
): Flow<BaseState<MyRestaurantData>> = repository.myRestaurantList(limit, page, sort)
): Flow<BaseState<MyRestaurantData>> =
repository.myRestaurantList(longitude, latitude, limit, page, sort)
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ abstract class BaseFragment<B : ViewDataBinding>(
}

fun showToastMessage(message: String) {
Toast.makeText(context, message, Toast.LENGTH_LONG).show()
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
}

fun showTwoButtonTitleDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.View
import com.avengers.nibobnebob.databinding.DialogRecommendRestaurantBinding
import com.avengers.nibobnebob.presentation.ui.main.home.adapter.HomeRecommendAdapter
import com.avengers.nibobnebob.presentation.ui.main.home.model.UiRecommendRestaurantData
Expand All @@ -13,7 +14,6 @@ class RecommendRestaurantDialog(
context: Context,
private val uiRecommendRestaurantDataList: List<UiRecommendRestaurantData>,
private val restaurantClickListener: (Int) -> Unit

) : Dialog(context) {

private lateinit var binding: DialogRecommendRestaurantBinding
Expand All @@ -35,6 +35,11 @@ class RecommendRestaurantDialog(
rvRecommendRestaurant.adapter = adapter
adapter.submitList(uiRecommendRestaurantDataList)

if(uiRecommendRestaurantDataList.isEmpty()){
binding.tvIsEmpty.visibility = View.VISIBLE
}


binding.tvCancel.setOnClickListener {
dismiss()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.avengers.nibobnebob.presentation.ui

import android.app.Activity
import androidx.activity.OnBackPressedCallback
import androidx.fragment.app.FragmentActivity
import androidx.navigation.NavController
import androidx.navigation.fragment.findNavController
import com.avengers.nibobnebob.NavGraphDirections


Expand Down Expand Up @@ -31,4 +35,12 @@ internal fun NavController.toMyPage() {
internal fun NavController.toUserDetail(nickName: String) {
val action = NavGraphDirections.globalToUserDetailFragment(nickName)
navigate(action)
}

internal fun customBack(activity : FragmentActivity, nav : NavController){
activity.onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
nav.navigateUp()
}
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ fun bindDoneButtonEnable(btn: AppCompatButton, state: EditProfileUiState?) = wit
state ?: return

val allValid = state.nickName.isValid && state.location.isValid && state.birth.isValid
val isChanged = state.nickName.isChanged || state.location.isChanged || state.birth.isChanged || state.profileImage.isChanged || state.isMale.isChanged
val isChanged =
state.nickName.isChanged || state.location.isChanged || state.birth.isChanged || state.profileImage.isChanged || state.isMale.isChanged

isEnabled = allValid && isChanged
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import com.avengers.nibobnebob.presentation.util.Constants.FILTER_NEW
import com.avengers.nibobnebob.presentation.util.Constants.FILTER_OLD
import com.avengers.nibobnebob.presentation.util.Constants.FILTER_WORST
import com.avengers.nibobnebob.presentation.util.LoginType
import com.google.android.material.textfield.TextInputLayout

// signup
@BindingAdapter("helperMessage")
Expand All @@ -38,6 +37,24 @@ fun bindHelpMessage(tv: TextView, inputState: InputState) = with(tv) {
}
}

//signup
@BindingAdapter("emailValidation")
fun bindEmailValidationr(tv: TextView, inputState: InputState) = with(tv) {
when (inputState) {
is InputState.Success -> {
setTextColor(ContextCompat.getColor(context, R.color.nn_dark6))
}

is InputState.Error -> {
setTextColor(ContextCompat.getColor(context, R.color.nn_dark6))
}

is InputState.Empty -> {
setTextColor(ContextCompat.getColor(context, R.color.nn_dark2))
}
}
}

@SuppressLint("SetTextI18n")
@BindingAdapter("textLength", "textLimit")
fun bindTextLength(tv: TextView, text: String, limit: Int) {
Expand Down Expand Up @@ -87,7 +104,7 @@ fun bindNickHelperText(tv: TextView, state: EditInputState?) = with(tv) {
@BindingAdapter("loginType")
fun bindLoginType(tv: TextView, type: String?) = with(tv) {
type ?: return
text = if (type == LoginType.NAVER_LOGIN) "네이버 소셜로그인" else ""
text = if (type == LoginType.NAVER_LOGIN) "네이버 소셜로그인" else "일반 로그인"
}

@BindingAdapter("filterType")
Expand All @@ -100,3 +117,8 @@ fun bindFilterType(tv: TextView, type: String) = with(tv) {
else -> ""
}
}

@BindingAdapter("adjustText")
fun bindLongText(tv: TextView, value: String) {
tv.text = if (value.length > 27) "${value.substring(0, 27)}.." else value
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ package com.avengers.nibobnebob.presentation.ui.intro

import android.Manifest
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.provider.MediaStore
import android.view.MotionEvent
import android.view.inputmethod.InputMethodManager
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.avengers.nibobnebob.databinding.ActivityIntroBinding
import com.avengers.nibobnebob.presentation.base.BaseActivity
import com.avengers.nibobnebob.presentation.ui.adjustKeyboard
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand Down Expand Up @@ -100,4 +104,10 @@ class IntroActivity : BaseActivity<ActivityIntroBinding>(ActivityIntroBinding::i
}
}
}

override fun onTouchEvent(event: MotionEvent?): Boolean {
val imm: InputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(currentFocus?.windowToken, 0)
return true
}
}
Loading

0 comments on commit 15a52c7

Please sign in to comment.