Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] feat: club 도메인 추가 #119

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9f88e9b
feat: club 도메인 추가
jimi567 Jul 18, 2024
78cb262
test: 불필요한 개행 제거
jimi567 Jul 18, 2024
f2a6ce9
refactor: @Temporal 어노테이션 제거
jimi567 Jul 18, 2024
ae321d9
refactor: 예외 메세지 상수 활용하도록 변경
jimi567 Jul 18, 2024
66e9edd
refactor: 상수명 변경
jimi567 Jul 18, 2024
42f0d17
fix: 연관관계 수정
jimi567 Jul 18, 2024
7eef18e
fix: h2예약어와 필드명 일치로 인한 버그 픽스
jimi567 Jul 19, 2024
4285b4e
fix: VO 필드명 Embedded로 변경
jimi567 Jul 19, 2024
030a952
chore: local용 profile 프로퍼티 추가
jimi567 Jul 19, 2024
2c690fe
feat: owner null 검증
jimi567 Jul 19, 2024
aae6f53
[BE] fix: CI 에서 server실행하려는 step삭제 (#118)
ehtjsv2 Jul 19, 2024
875b07e
feat: ManyToMany 연관 관계 제거
jimi567 Jul 19, 2024
26f91a5
[AN] feat: 멍멍 짖기 기능 구현 (#108)
dpcks0509 Jul 19, 2024
f915bcd
[AN] feat: 멍개 리스트 기능 구현 (#128)
jinuemong Jul 19, 2024
4c678d0
[AN] feat: 채팅리스트 adapter 연결 (#111)
gaeun5744 Jul 19, 2024
428bf04
[AN] feat: 댕댕이 등록하기 (#98)
junjange Jul 19, 2024
4834a14
style: 어노테이션 선언순서 컨벤션에 맞도록 변경
jimi567 Jul 19, 2024
6b98496
[AN] feat: 내 강아지 상세 화면 (#116)
junjange Jul 19, 2024
8b96054
[AN] feat: 바텀 내비게이션 연결 (#103)
junjange Jul 19, 2024
78ccdc4
style: Column name 옵션 적용
jimi567 Jul 19, 2024
69a0b9d
feat: club 도메인 추가
jimi567 Jul 18, 2024
3d421f6
test: 불필요한 개행 제거
jimi567 Jul 18, 2024
9be4a8d
refactor: @Temporal 어노테이션 제거
jimi567 Jul 18, 2024
d7eb9e8
refactor: 예외 메세지 상수 활용하도록 변경
jimi567 Jul 18, 2024
b38a3a8
refactor: 상수명 변경
jimi567 Jul 18, 2024
c8a1fe9
fix: 연관관계 수정
jimi567 Jul 18, 2024
34ee388
fix: h2예약어와 필드명 일치로 인한 버그 픽스
jimi567 Jul 19, 2024
1e8c694
fix: VO 필드명 Embedded로 변경
jimi567 Jul 19, 2024
c041246
chore: local용 profile 프로퍼티 추가
jimi567 Jul 19, 2024
507c654
feat: owner null 검증
jimi567 Jul 19, 2024
a45a0b2
feat: ManyToMany 연관 관계 제거
jimi567 Jul 19, 2024
842c55f
style: 어노테이션 선언순서 컨벤션에 맞도록 변경
jimi567 Jul 19, 2024
7a3a032
style: Column name 옵션 적용
jimi567 Jul 19, 2024
711f0d4
Merge branch 'feature/club-entity' of https://github.com/woowacourse-…
jimi567 Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/backend-pull-request-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,3 @@ jobs:
with:
report_paths: './backend/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}

- name: Start server
run: |
sudo nohup java -jar build/libs/friendogly-0.0.1-SNAPSHOT.jar &
echo "Lastest Backend API Server started."
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 39 additions & 6 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ render.experimental.xml
*.keystore

# Google Services (e.g. APIs or Firebase)
google-services.json
app/google-services.json

# Android Profiling
*.hprof
Expand Down
7 changes: 7 additions & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ plugins {
alias(libs.plugins.navigation.safeargs)
id("kotlin-kapt")
id("com.google.gms.google-services")
id("kotlin-parcelize")
}

val localPropertiesFile = rootProject.file("local.properties")
val localProperties = Properties()
localProperties.load(FileInputStream(localPropertiesFile))

val googleClientId = localProperties.getProperty("GOOGLE_CLIENT_ID") ?: ""
val naverClientId = localProperties.getProperty("NAVER_CLIEND_ID") ?: ""
val baseUrl = localProperties.getProperty("base_url") ?: ""

android {
namespace = "com.woowacourse.friendogly"
Expand All @@ -29,6 +32,8 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

buildConfigField("String", "GOOGLE_CLIENT_ID", googleClientId)
buildConfigField("String", "NAVER_CLIEND_ID", naverClientId)
buildConfigField("String", "base_url", baseUrl)
}

buildTypes {
Expand Down Expand Up @@ -62,6 +67,8 @@ dependencies {
implementation(libs.bundles.navigation)
implementation(libs.bundles.google)
implementation(libs.bundles.kakao)
implementation(libs.bundles.naver)
implementation(libs.bundles.location)
implementation(libs.bundles.network)
implementation(libs.bundles.datastore)
testImplementation(libs.bundles.test)
Expand Down
7 changes: 7 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<application
android:name=".application.FriendoglyApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand All @@ -11,7 +16,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Friendogly"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<activity
android:name=".presentation.ui.profilesetting.ProfileSettingActivity"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.woowacourse.friendogly.application

import android.app.Application
import com.naver.maps.map.NaverMapSdk
import com.woowacourse.friendogly.BuildConfig

class FriendoglyApplication : Application() {
override fun onCreate() {
super.onCreate()
initNaverMapSdk()
}

private fun initNaverMapSdk() {
NaverMapSdk.getInstance(this).client =
NaverMapSdk.NaverCloudPlatformClient(BuildConfig.NAVER_CLIEND_ID)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.woowacourse.friendogly.presentation.ui

import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.view.View
import androidx.core.app.ActivityCompat
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
Expand All @@ -18,6 +21,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {

override fun initCreateView() {
initNavController()
requestLocationPermissions()
}

private fun initNavController() {
Expand All @@ -27,7 +31,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {

navController.addOnDestinationChangedListener { _, destination, _ ->
when (destination.id) {
R.id.homeFragment, R.id.woofFragment, R.id.chatFragment, R.id.myPageFragment -> showBottomNav()
R.id.groupListFragment, R.id.woofFragment, R.id.chatListFragment, R.id.myPageFragment -> showBottomNav()
else -> hideBottomNav()
}
}
Expand All @@ -49,7 +53,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
super.onBackPressed()
} else {
when (navController.currentDestination?.id) {
R.id.homeFragment -> {
R.id.groupListFragment -> {
if (System.currentTimeMillis() - waitTime >= 1500) {
waitTime = System.currentTimeMillis()
showToastMessage(getString(R.string.on_back_pressed_Message))
Expand All @@ -67,7 +71,28 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
}
}

private fun requestLocationPermissions() {
if (ActivityCompat.checkSelfPermission(
this,
Manifest.permission.ACCESS_FINE_LOCATION,
) != PackageManager.PERMISSION_GRANTED ||
ActivityCompat.checkSelfPermission(
this,
Manifest.permission.ACCESS_COARSE_LOCATION,
) != PackageManager.PERMISSION_GRANTED
) {
val permissions =
arrayOf(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
)
ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE)
}
}

companion object {
const val LOCATION_PERMISSION_REQUEST_CODE = 100

fun getIntent(context: Context): Intent {
return Intent(context, MainActivity::class.java)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.woowacourse.friendogly.presentation.ui.chatlist

import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.woowacourse.friendogly.R
import com.woowacourse.friendogly.presentation.ui.chatlist.uimodel.ChatDateTime
import java.time.format.DateTimeFormatter

private const val MAX_MESSAGE_COUNT = 999

@BindingAdapter("chatDateTime")
fun TextView.dateTimeString(dateTime: ChatDateTime) {
val timeFormatter = DateTimeFormatter.ofPattern(context.getString(R.string.chat_time))
val dateFormatter = DateTimeFormatter.ofPattern(context.getString(R.string.chat_date))

this.text =
when (dateTime) {
is ChatDateTime.Today -> dateTime.value.format(timeFormatter)
is ChatDateTime.Yesterday -> context.getString(R.string.chat_yesterday)
is ChatDateTime.NotRecent -> dateTime.value.format(dateFormatter)
}
}

@BindingAdapter("unreadMessageCount")
fun TextView.unreadMessage(count: Int) {
this.text =
if (count >= MAX_MESSAGE_COUNT) {
context.getString(R.string.chat_unread_max_count)
} else {
count.toString()
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
package com.woowacourse.friendogly.presentation.ui.chatlist

import androidx.fragment.app.viewModels
import com.woowacourse.friendogly.R
import com.woowacourse.friendogly.databinding.FragmentChatListBinding
import com.woowacourse.friendogly.presentation.base.BaseFragment
import com.woowacourse.friendogly.presentation.ui.chatlist.adapter.ChatListAdapter

class ChatListFragment : BaseFragment<FragmentChatListBinding>(R.layout.fragment_chat_list) {
private val viewModel: ChatListViewModel by viewModels()
private lateinit var adapter: ChatListAdapter

override fun initViewCreated() {
initAdapter()
}

private fun initAdapter() {
adapter = ChatListAdapter()
binding.rcvChatList.adapter = adapter
viewModel.getChats()
viewModel.chats.observe(viewLifecycleOwner) { chats ->
adapter.submitList(chats)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.woowacourse.friendogly.presentation.ui.chatlist

import com.woowacourse.friendogly.presentation.ui.chatlist.uimodel.ChatDateTime
import com.woowacourse.friendogly.presentation.ui.chatlist.uimodel.ChatDummy
import com.woowacourse.friendogly.presentation.ui.chatlist.uimodel.ChatListUiModel
import java.time.LocalDate
import java.time.LocalDateTime

fun ChatDummy.toUiModel(): ChatListUiModel =
ChatListUiModel(
title,
body,
numberOfPeople,
unreadMessageCount,
dateTime.classifyChatDateTime(),
imageUrl,
)

private fun LocalDateTime.classifyChatDateTime(): ChatDateTime {
val today = LocalDate.now()
val date = this.toLocalDate()

return when {
date.isEqual(today) -> ChatDateTime.Today(this)
date.isEqual(today.minusDays(ChatListUiModel.YESTERDAY)) -> ChatDateTime.Yesterday(this)
else -> ChatDateTime.NotRecent(this)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.woowacourse.friendogly.presentation.ui.chatlist

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.woowacourse.friendogly.presentation.ui.chatlist.uimodel.ChatDummy
import com.woowacourse.friendogly.presentation.ui.chatlist.uimodel.ChatListUiModel
import java.time.LocalDateTime

class ChatListViewModel : ViewModel() {
private val _chats: MutableLiveData<List<ChatListUiModel>> = MutableLiveData()
val chats: LiveData<List<ChatListUiModel>> get() = _chats

fun getChats() {
_chats.value = dummyChats.map { it.toUiModel() }
}

companion object {
private val dummyChats =
listOf(
ChatDummy(
"방가방가",
"다들 언제 모이시는게 편하세요?",
3,
7,
LocalDateTime.of(2024, 7, 2, 14, 12, 0),
"https://www.dailysecu.com/news/photo/202" +
"104/123449_145665_1147.png",
),
ChatDummy(
"잠실 강아지 정모",
"땡이는.... 소형견인 건가요...?",
5,
32,
LocalDateTime.of(2024, 7, 17, 9, 0, 12),
"https://img.khan.co.kr/news/2024/03/23/news-" +
"p.v1.20240323.c159a4cab6f64473adf462d873e01e43_P1.jpg",
),
ChatDummy(
"때래때떙",
"저 돼지껍데기 먹고싶어요",
12,
1000,
LocalDateTime.now(),
"https://img1.daumcdn.net/thumb/R1280x0.fjpg/?fname=http:" +
"//t1.daumcdn.net/brunch/service/user/32E9/image/BA2Qyx3O2oTyEOsXe2ZtE8cRqGk.JPG",
),
).sortedByDescending { it.dateTime }
}
}
Loading
Loading