From badd5cee1cd0fd2704a8754c948cb8b587d72bbc Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:04:15 +0900 Subject: [PATCH 01/37] =?UTF-8?q?Chore:=20gitignore=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=EB=B0=8F=20chat=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 8 +- .../gradle-8.0-bin.zip.lck | 0 .../gradle-8.0-bin.zip.ok | 0 .../gradle-8.0/LICENSE | 420 ++++++++++++++++++ .../gradle-8.0/NOTICE | 21 + .../gradle-8.0/README | 11 + .../gradle-8.0/bin/gradle | 244 ++++++++++ .../gradle-8.0/bin/gradle.bat | 92 ++++ .../gradle-8.0/init.d/readme.txt | 1 + 9 files changed, 796 insertions(+), 1 deletion(-) create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0-bin.zip.lck create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0-bin.zip.ok create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/LICENSE create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/NOTICE create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/README create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle.bat create mode 100644 gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/init.d/readme.txt diff --git a/.gitignore b/.gitignore index fd5ec37bee..1a6145ee49 100644 --- a/.gitignore +++ b/.gitignore @@ -284,4 +284,10 @@ gradle-app.setting # Java heap dump *.hprof -# End of https://www.toptal.com/developers/gitignore/api/java,intellij,gradle,macos,windows,intellij+all \ No newline at end of file +# End of https://www.toptal.com/developers/gitignore/api/java,intellij,gradle,macos,windows,intellij+all + +gradle/caches +gradle/.tmp +gradle/daemon +gradle/jdks +gradle/native \ No newline at end of file diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0-bin.zip.lck b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0-bin.zip.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0-bin.zip.ok b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0-bin.zip.ok new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/LICENSE b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/LICENSE new file mode 100644 index 0000000000..f013fd5ddb --- /dev/null +++ b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/LICENSE @@ -0,0 +1,420 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + +============================================================================== +Licenses for included components: + +------------------------------------------------------------------------------ +Eclipse Public License 1.0 +https://opensource.org/licenses/EPL-1.0 + +junit:junit +org.sonatype.aether:aether-api +org.sonatype.aether:aether-connector-wagon +org.sonatype.aether:aether-impl +org.sonatype.aether:aether-spi +org.sonatype.aether:aether-util + +------------------------------------------------------------------------------ +3-Clause BSD +https://opensource.org/licenses/BSD-3-Clause + +com.google.code.findbugs:jsr305 + +org.hamcrest:hamcrest-core +BSD License + +Copyright (c) 2000-2015 www.hamcrest.org +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of Hamcrest nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +com.esotericsoftware.kryo:kryo +com.esotericsoftware.minlog:minlog +Copyright (c) 2008-2018, Nathan Sweet All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +Neither the name of Esoteric Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +org.ow2.asm:asm +org.ow2.asm:asm-analysis +org.ow2.asm:asm-commons +org.ow2.asm:asm-tree +org.ow2.asm:asm-util +ASM: a very small and fast Java bytecode manipulation framework + Copyright (c) 2000-2011 INRIA, France Telecom + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +MIT + +com.googlecode.plist:dd-plist +dd-plist - An open source library to parse and generate property lists +Copyright (C) 2016 Daniel Dreibrodt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +org.bouncycastle:bcpg-jdk15on +org.bouncycastle:bcprov-jdk15on +Copyright (c) 2000 - 2019 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +org.slf4j:jcl-over-slf4j +org.slf4j:jul-to-slf4j +org.slf4j:log4j-over-slf4j +org.slf4j:slf4j-api + Copyright (c) 2004-2017 QOS.ch + All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +------------------------------------------------------------------------------ +CDDL +https://opensource.org/licenses/CDDL-1.0 + +com.sun.xml.bind:jaxb-impl + +------------------------------------------------------------------------------ +LGPL 2.1 +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html + +org.samba.jcifs:jcifs + +org.jetbrains.intellij.deps:trove4j + +------------------------------------------------------------------------------ +License for the GNU Trove library included by the Kotlin embeddable compiler +------------------------------------------------------------------------------ +The source code for GNU Trove is licensed under the Lesser GNU Public License (LGPL). + + Copyright (c) 2001, Eric D. Friedman All Rights Reserved. This library is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +Two classes (HashFunctions and PrimeFinder) included in Trove are licensed under the following terms: + + Copyright (c) 1999 CERN - European Organization for Nuclear Research. Permission to use, copy, modify, distribute and sell this software + and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and + that both that copyright notice and this permission notice appear in supporting documentation. CERN makes no representations about the + suitability of this software for any purpose. It is provided "as is" without expressed or implied warranty. + +The source code of modified GNU Trove library is available at + https://github.com/JetBrains/intellij-deps-trove4j (with trove4j_changes.txt describing the changes) + +------------------------------------------------------------------------------ +Eclipse Distribution License 1.0 +https://www.eclipse.org/org/documents/edl-v10.php + +org.eclipse.jgit:org.eclipse.jgit + +------------------------------------------------------------------------------ +BSD-style + +com.jcraft:jsch +com.jcraft:jzlib + +Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + + 3. The names of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, +INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +Eclipse Public License 2.0 +https://www.eclipse.org/legal/epl-2.0/ + +org.junit.platform:junit-platform-launcher + +------------------------------------------------------------------------------ +Mozilla Public License 2.0 +https://www.mozilla.org/en-US/MPL/2.0/ + +org.mozilla:rhino diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/NOTICE b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/NOTICE new file mode 100644 index 0000000000..00a36efcde --- /dev/null +++ b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/NOTICE @@ -0,0 +1,21 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Gradle distribution. == +========================================================================= + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + +It includes the following other software: + +Groovy (http://groovy-lang.org) +SLF4J (http://www.slf4j.org) +JUnit (http://www.junit.org) +JCIFS (http://jcifs.samba.org) +HttpClient (https://hc.apache.org/httpcomponents-client-4.5.x/) + +For licenses, see the LICENSE file. + +If any software distributed with Gradle does not have an Apache 2 License, its license is explicitly listed in the +LICENSE file. diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/README b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/README new file mode 100644 index 0000000000..97d48bdc51 --- /dev/null +++ b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/README @@ -0,0 +1,11 @@ +Gradle is a build tool with a focus on build automation and support for multi-language development. If you are building, testing, publishing, and deploying software on any platform, Gradle offers a flexible model that can support the entire development lifecycle from compiling and packaging code to publishing web sites. Gradle has been designed to support build automation across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is closely integrated with development tools and continuous integration servers including Eclipse, IntelliJ, and Jenkins. + +For more information about Gradle, please visit: https://gradle.org + +If you are using the "all" distribution, the User Manual is included in your distribution. + +If you are using the "bin" distribution, a copy of the User Manual is available on https://docs.gradle.org. + +Typing `gradle help` prints the command line help. + +Typing `gradle tasks` shows all the tasks of a Gradle build. diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle new file mode 100644 index 0000000000..5e152d7195 --- /dev/null +++ b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle @@ -0,0 +1,244 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/lib/gradle-launcher-8.0.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.launcher.GradleMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle.bat b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle.bat new file mode 100644 index 0000000000..3d017f471e --- /dev/null +++ b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/bin/gradle.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME%.. + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\lib\gradle-launcher-8.0.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.launcher.GradleMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/init.d/readme.txt b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/init.d/readme.txt new file mode 100644 index 0000000000..d8e210f840 --- /dev/null +++ b/gradle/wrapper/dists/gradle-8.0-bin/ca5e32bp14vu59qr306oxotwh/gradle-8.0/init.d/readme.txt @@ -0,0 +1 @@ +You can add .gradle (e.g. test.gradle) init scripts to this directory. Each one is executed at the start of the build. From f814e3c41d509a01427c679b17b6837e4e1994bb Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:17:05 +0900 Subject: [PATCH 02/37] =?UTF-8?q?Feat:=20ChatRoom=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facefriend/chat/domain/ChatRoom.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/domain/ChatRoom.java diff --git a/src/main/java/capstone/facefriend/chat/domain/ChatRoom.java b/src/main/java/capstone/facefriend/chat/domain/ChatRoom.java new file mode 100644 index 0000000000..e2daef07ed --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/domain/ChatRoom.java @@ -0,0 +1,50 @@ +package capstone.facefriend.chat.domain; + +import capstone.facefriend.common.domain.BaseEntity; +import jakarta.persistence.*; +import lombok.*; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.annotations.DynamicInsert; + +@Getter +@Setter +@Builder +@EqualsAndHashCode(of = "id", callSuper = false) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Entity +@Slf4j +@DynamicInsert +public class ChatRoom extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Enumerated(EnumType.STRING) + @Column + private Status status = Status.set; + + @Column + private boolean isPublic; + + public enum Status { + set("Set"), + open("Open"), + + progress("Progres"), + close("Close"), + delete("Delete"); + private final String value; + + Status(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + } + + +} \ No newline at end of file From 673924aec086f207bd73deff520781f8f0349d1b Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:17:42 +0900 Subject: [PATCH 03/37] =?UTF-8?q?Feat:=20ChatRoomMember=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/domain/ChatRoomMember.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/domain/ChatRoomMember.java diff --git a/src/main/java/capstone/facefriend/chat/domain/ChatRoomMember.java b/src/main/java/capstone/facefriend/chat/domain/ChatRoomMember.java new file mode 100644 index 0000000000..9762e0d698 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/domain/ChatRoomMember.java @@ -0,0 +1,65 @@ +package capstone.facefriend.chat.domain; + +import capstone.facefriend.common.domain.BaseEntity; +import capstone.facefriend.member.domain.Member; +import jakarta.persistence.*; +import lombok.*; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.annotations.DynamicInsert; + +@Getter +@Setter +@Builder +@EqualsAndHashCode(of = "id", callSuper = false) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Entity +@Slf4j +@DynamicInsert +public class ChatRoomMember extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToOne + @JoinColumn(name = "Room_ID") + private ChatRoom chatRoom; + + @ManyToOne + @JoinColumn(name = "SENDER_ID") + private Member sender; + + @ManyToOne + @JoinColumn(name = "RECEIVER_ID") + private Member receiver; + + @Column + private boolean isSenderExist; + + @Column + private boolean isReceiverExist; + + @Column + private boolean isSenderPublic; + + @Column + private boolean isReceiverPublic; + + public void setChatRoom(ChatRoom chatRoom) { + this.chatRoom = chatRoom; + } + public void setSender(Member Sender) { + this.sender = sender; + } + public void setReceiver(Member Sender) { + this.receiver = receiver; + } + + public boolean isSenderExist() {return this.isSenderExist == true;} + public boolean isReceiverExist() {return this.isReceiverExist == true;} + public boolean isSenderPublic() {return this.isSenderPublic == true;} + public boolean isReceiverPublic() {return this.isReceiverPublic == true;} + + +} \ No newline at end of file From e2ddee64f14111618204072f410ac492d435919e Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:17:49 +0900 Subject: [PATCH 04/37] =?UTF-8?q?Feat:=20ChatMessage=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facefriend/chat/domain/ChatMessage.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/domain/ChatMessage.java diff --git a/src/main/java/capstone/facefriend/chat/domain/ChatMessage.java b/src/main/java/capstone/facefriend/chat/domain/ChatMessage.java new file mode 100644 index 0000000000..f01c4382ca --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/domain/ChatMessage.java @@ -0,0 +1,51 @@ +package capstone.facefriend.chat.domain; + +import capstone.facefriend.common.domain.BaseEntity; +import capstone.facefriend.member.domain.Member; +import jakarta.persistence.*; +import lombok.*; +import lombok.extern.slf4j.Slf4j; +import org.hibernate.annotations.DynamicInsert; + +import java.time.LocalDateTime; + +@Getter +@Setter +@Builder +@EqualsAndHashCode(of = "id", callSuper = false) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Entity +@Slf4j +@DynamicInsert +public class ChatMessage extends BaseEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false) + private String content; + + @Column(nullable = false) + private LocalDateTime sendTime; + + @Column + private boolean isRead; + + @ManyToOne + @JoinColumn(name = "SENDER_ID") + private Member sender; + + @ManyToOne + @JoinColumn(name = "ROOM_ID") + private ChatRoom chatRoom; + + public void setMember(Member sender) { + this.sender = sender; + } + + public void setChatRoom(ChatRoom ChatRoom) { + this.chatRoom = ChatRoom; + } +} \ No newline at end of file From 28c06a8e169ffdf67f411dd7b14349e8ef9f18fd Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:20:55 +0900 Subject: [PATCH 05/37] =?UTF-8?q?Feat:=20build.gradle=20dependencies=20?= =?UTF-8?q?=EC=84=B8=EC=85=98=EC=97=90=20websocket=EC=9D=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index c92fbe932f..099c062793 100644 --- a/build.gradle +++ b/build.gradle @@ -51,6 +51,12 @@ dependencies { // AWS S3 implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' + // WebSocket + implementation 'org.springframework.boot:spring-boot-starter-websocket' + + // SockJs + implementation 'org.webjars:sockjs-client:1.5.1' + // jasypt implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5' } From cdc37f9b612de270aa9644e98b2efc4f7a1f555c Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:40:32 +0900 Subject: [PATCH 06/37] =?UTF-8?q?Feat:=20WebSocket=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=84=A4=EC=A0=95=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facefriend/chat/config/ChatConfig.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/config/ChatConfig.java diff --git a/src/main/java/capstone/facefriend/chat/config/ChatConfig.java b/src/main/java/capstone/facefriend/chat/config/ChatConfig.java new file mode 100644 index 0000000000..d54818d4ba --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/config/ChatConfig.java @@ -0,0 +1,35 @@ +package capstone.facefriend.chat.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.simp.config.MessageBrokerRegistry; +import org.springframework.web.socket.config.annotation.EnableWebSocket; +import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; +import org.springframework.web.socket.config.annotation.StompEndpointRegistry; +import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; + +@Configuration +@EnableWebSocket +@EnableWebSocketMessageBroker +public class ChatConfig implements WebSocketMessageBrokerConfigurer { + + // sockJS Fallback을 이용해 노출할 endpoint 설정 + @Override + public void registerStompEndpoints(StompEndpointRegistry registry) { + // 웹소켓이 handshake를 하기 위해 연결하는 endpoint + registry.addEndpoint("/ws") + .setAllowedOriginPatterns("*"); +// .withSockJS(); + + } + + //메세지 브로커에 관한 설정 + @Override + public void configureMessageBroker(MessageBrokerRegistry registry) { + // 서버 -> 클라이언트로 발행하는 메세지에 대한 endpoint 설정 : 구독 + registry.enableSimpleBroker("/sub"); + + // 클라이언트->서버로 발행하는 메세지에 대한 endpoint 설정 : 구독에 대한 메세지 + registry.setApplicationDestinationPrefixes("/pub"); + } +} + From 1faaefd38f926d986b9fad9783a23ce173ea396f Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:42:25 +0900 Subject: [PATCH 07/37] =?UTF-8?q?Feat:=20ChatRoom=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20Controller=20class=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/controller/ChatRoomController.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java diff --git a/src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java b/src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java new file mode 100644 index 0000000000..1d8d14d2f9 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java @@ -0,0 +1,11 @@ +package capstone.facefriend.chat.controller; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Slf4j +@RequiredArgsConstructor +public class ChatRoomController { +} \ No newline at end of file From 139a065132e68dce14c1c7e4f11d442a85df07c9 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:43:27 +0900 Subject: [PATCH 08/37] =?UTF-8?q?Feat:=20ChatRoom=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20Service=20class=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../capstone/facefriend/chat/service/ChatRoomService.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/ChatRoomService.java diff --git a/src/main/java/capstone/facefriend/chat/service/ChatRoomService.java b/src/main/java/capstone/facefriend/chat/service/ChatRoomService.java new file mode 100644 index 0000000000..39f48aff83 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/ChatRoomService.java @@ -0,0 +1,4 @@ +package capstone.facefriend.chat.service; + +public class ChatRoomService { +} From 95bc67313d65b27a86d9e62e4d188d1106a32f80 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:44:11 +0900 Subject: [PATCH 09/37] =?UTF-8?q?Feat:=20=EC=9E=91=EC=84=B1=ED=95=9C=20?= =?UTF-8?q?=EB=8F=84=EB=A9=94=EC=9D=B8=EC=97=90=20=EB=8C=80=ED=95=9C=20rep?= =?UTF-8?q?ository=20interface=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facefriend/chat/repository/ChatMessageRepository.java | 4 ++++ .../facefriend/chat/repository/ChatRoomMemberRepository.java | 4 ++++ .../facefriend/chat/repository/ChatRoomRepository.java | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java create mode 100644 src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java create mode 100644 src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java new file mode 100644 index 0000000000..7e1ec098e3 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java @@ -0,0 +1,4 @@ +package capstone.facefriend.chat.repository; + +public interface ChatMessageRepository { +} diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java new file mode 100644 index 0000000000..db472c61e7 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java @@ -0,0 +1,4 @@ +package capstone.facefriend.chat.repository; + +public interface ChatRoomMemberRepository { +} diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java new file mode 100644 index 0000000000..62a8e94d7c --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java @@ -0,0 +1,4 @@ +package capstone.facefriend.chat.repository; + +public interface ChatRoomRepository { +} From ef99e90c55b79c4dc19b5edbf8a3865e09a2acc7 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:44:39 +0900 Subject: [PATCH 10/37] =?UTF-8?q?Feat:=20Message=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20Controller=20class=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/controller/MessageController.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/controller/MessageController.java diff --git a/src/main/java/capstone/facefriend/chat/controller/MessageController.java b/src/main/java/capstone/facefriend/chat/controller/MessageController.java new file mode 100644 index 0000000000..9dffed43d1 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/controller/MessageController.java @@ -0,0 +1,12 @@ +package capstone.facefriend.chat.controller; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Slf4j +@RequiredArgsConstructor +public class MessageController { + +} \ No newline at end of file From 4314c882e2cf8eacb6d2abfeb5f8a20c07a050ff Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:44:47 +0900 Subject: [PATCH 11/37] =?UTF-8?q?Feat:=20Message=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20Service=20class=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facefriend/chat/service/MessageService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/MessageService.java diff --git a/src/main/java/capstone/facefriend/chat/service/MessageService.java b/src/main/java/capstone/facefriend/chat/service/MessageService.java new file mode 100644 index 0000000000..f927460676 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/MessageService.java @@ -0,0 +1,11 @@ +package capstone.facefriend.chat.service; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +@RequiredArgsConstructor +public class MessageService { +} \ No newline at end of file From 714e71922765eab9dbb4100f180aa84677ed6f26 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:51:27 +0900 Subject: [PATCH 12/37] =?UTF-8?q?Feat:=20=ED=95=84=EC=9A=94=ED=95=9C=20JPA?= =?UTF-8?q?=20method=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/repository/ChatMessageRepository.java | 10 ++++++++-- .../chat/repository/ChatRoomMemberRepository.java | 12 ++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java index 7e1ec098e3..b4ed24bbb5 100644 --- a/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java +++ b/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java @@ -1,4 +1,10 @@ package capstone.facefriend.chat.repository; -public interface ChatMessageRepository { -} +import capstone.facefriend.chat.domain.ChatMessage; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface ChatMessageRepository extends JpaRepository { + ChatMessage findFirstByChatRoomIdOrderBySendTimeDesc(Long roomId); + +} \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java index db472c61e7..f93f7aa943 100644 --- a/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java +++ b/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java @@ -1,4 +1,12 @@ package capstone.facefriend.chat.repository; -public interface ChatRoomMemberRepository { -} +import capstone.facefriend.chat.domain.ChatRoomMember; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface ChatRoomMemberRepository extends JpaRepository { + Optional> findAllBySenderId(Long senderId); + Optional> findAllByReceiverId(Long senderId); +} \ No newline at end of file From 5e4b2b9320e65ef9549bd398d1892c1de2a3bd81 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:53:42 +0900 Subject: [PATCH 13/37] =?UTF-8?q?Feat:=20=EC=B1=84=ED=8C=85=EB=B0=A9=20?= =?UTF-8?q?=EC=97=86=EC=9D=84=20=EB=95=8C=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EB=8A=94=20ChatRoomEmptyResponse=20dto=20class=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/dto/chatroom/ChatRoomEmptyResponse.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomEmptyResponse.java diff --git a/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomEmptyResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomEmptyResponse.java new file mode 100644 index 0000000000..ae7050b979 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomEmptyResponse.java @@ -0,0 +1,13 @@ +package capstone.facefriend.chat.service.dto.chatroom; + +public record ChatRoomEmptyResponse( + Boolean isEmpty, + String message +){ + public static ChatRoomEmptyResponse of(String message) { + return new ChatRoomEmptyResponse( + true, + message + ); + } +} \ No newline at end of file From 5dd878baa570980611b4b0bce8d7c83ac23a5456 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:55:13 +0900 Subject: [PATCH 14/37] =?UTF-8?q?Feat:=20=EC=B1=84=ED=8C=85=EB=B0=A9?= =?UTF-8?q?=EC=9D=B4=20=EC=9E=88=EC=9D=84=20=EB=95=8C,=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=95=84=EC=9A=94=20?= =?UTF-8?q?dto=20class=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/chatroom/ChatRoomHeartResponse.java | 22 +++++++++++++ .../dto/chatroom/ChatRoomMessageResponse.java | 32 +++++++++++++++++++ .../dto/heart/GetSendHeartResponse.java | 31 ++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomHeartResponse.java create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomMessageResponse.java create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/heart/GetSendHeartResponse.java diff --git a/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomHeartResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomHeartResponse.java new file mode 100644 index 0000000000..d3a9457690 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomHeartResponse.java @@ -0,0 +1,22 @@ +package capstone.facefriend.chat.service.dto.chatroom; + +import capstone.facefriend.chat.domain.ChatRoom; +import capstone.facefriend.chat.domain.ChatRoomMember; +import capstone.facefriend.chat.service.dto.heart.GetSendHeartResponse; + +public record ChatRoomHeartResponse ( + Long sender, + Long receiver, + ChatRoom chatRoom, + GetSendHeartResponse sendHeart + +) { + public static ChatRoomHeartResponse of(ChatRoomMember chatRoomMember, GetSendHeartResponse sendHeartResponse) { + return new ChatRoomHeartResponse( + chatRoomMember.getSender().getId(), + chatRoomMember.getReceiver().getId(), + chatRoomMember.getChatRoom(), + sendHeartResponse + ); + } +} \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomMessageResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomMessageResponse.java new file mode 100644 index 0000000000..528dbd750c --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomMessageResponse.java @@ -0,0 +1,32 @@ +package capstone.facefriend.chat.service.dto.chatroom; + +import capstone.facefriend.chat.domain.ChatMessage; +import capstone.facefriend.chat.domain.ChatRoom; +import capstone.facefriend.chat.domain.ChatRoomMember; + +import java.time.LocalDateTime; + +public record ChatRoomMessageResponse( + Long sender, + Long receiver, + ChatRoom chatRoom, + String content, + LocalDateTime sendTime, + String senderNickname, + String senderGeneratedFaceInfo, + String senderOriginalFaceInfo + +){ + public static ChatRoomMessageResponse of(ChatRoomMember chatRoomMember, ChatMessage message) { + return new ChatRoomMessageResponse( + chatRoomMember.getSender().getId(), + chatRoomMember.getReceiver().getId(), + chatRoomMember.getChatRoom(), + message.getContent(), + message.getSendTime(), + message.getSender().getBasicInfo().getNickname(), + message.getSender().getFaceInfo().getGeneratedS3url(), + message.getSender().getFaceInfo().getOriginS3Url() + ); + } +} \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/service/dto/heart/GetSendHeartResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/heart/GetSendHeartResponse.java new file mode 100644 index 0000000000..8e510750aa --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/heart/GetSendHeartResponse.java @@ -0,0 +1,31 @@ +package capstone.facefriend.chat.service.dto.heart; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Setter +@Data +@NoArgsConstructor +public class GetSendHeartResponse { + private String senderName; + private Long senderId; + private Long receiveId; + private String type; + private Long roomId; + @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") + private LocalDateTime createdAt; + + + public GetSendHeartResponse(SendHeartResponse sendHeartResponse) { + this.senderName = sendHeartResponse.getSenderName(); + this.senderId = sendHeartResponse.getSenderId(); + this.receiveId = sendHeartResponse.getReceiveId(); + this.type = sendHeartResponse.getType(); + this.roomId = sendHeartResponse.getRoomId(); + this.createdAt = sendHeartResponse.getCreatedAt(); + } +} \ No newline at end of file From dba13588e0de7b8214d22de744af4669471c973e Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:56:13 +0900 Subject: [PATCH 15/37] =?UTF-8?q?Feat:=20=EC=B1=84=ED=8C=85=EB=B0=A9?= =?UTF-8?q?=EC=9D=B4=20=EC=9E=88=EC=9D=84=20=EB=95=8C,=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=95=84=EC=9A=94=20?= =?UTF-8?q?dto=20class=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/chatroom/ChatRoomOpenResponse.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomOpenResponse.java diff --git a/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomOpenResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomOpenResponse.java new file mode 100644 index 0000000000..393f9a8880 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/chatroom/ChatRoomOpenResponse.java @@ -0,0 +1,15 @@ +package capstone.facefriend.chat.service.dto.chatroom; + +public record ChatRoomOpenResponse ( + Long senderId, + String senderNickname, + String message +) { + public static ChatRoomOpenResponse of(Long senderId, String senderNickname, String message) { + return new ChatRoomOpenResponse( + senderId, + senderNickname, + message + ); + } +} \ No newline at end of file From 1b8cfa26e7123edce9002cac85d464edf4346ca2 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:57:35 +0900 Subject: [PATCH 16/37] =?UTF-8?q?Feat:=20=EC=B1=84=ED=8C=85=EB=B0=A9=20lis?= =?UTF-8?q?t=EB=A5=BC=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EA=B8=B0=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20service=20code=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/service/ChatRoomService.java | 91 ++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/src/main/java/capstone/facefriend/chat/service/ChatRoomService.java b/src/main/java/capstone/facefriend/chat/service/ChatRoomService.java index 39f48aff83..2cfd9dfb7e 100644 --- a/src/main/java/capstone/facefriend/chat/service/ChatRoomService.java +++ b/src/main/java/capstone/facefriend/chat/service/ChatRoomService.java @@ -1,4 +1,93 @@ package capstone.facefriend.chat.service; +import capstone.facefriend.chat.domain.ChatMessage; +import capstone.facefriend.chat.domain.ChatRoom; +import capstone.facefriend.chat.domain.ChatRoomMember; +import capstone.facefriend.chat.repository.ChatMessageRepository; +import capstone.facefriend.chat.repository.ChatRoomMemberRepository; +import capstone.facefriend.chat.service.dto.chatroom.ChatRoomEmptyResponse; +import capstone.facefriend.chat.service.dto.chatroom.ChatRoomHeartResponse; +import capstone.facefriend.chat.service.dto.chatroom.ChatRoomMessageResponse; +import capstone.facefriend.chat.service.dto.chatroom.ChatRoomOpenResponse; +import capstone.facefriend.chat.service.dto.heart.GetSendHeartResponse; +import capstone.facefriend.member.domain.Member; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +@Slf4j +@RequiredArgsConstructor public class ChatRoomService { -} + + private final ChatRoomMemberRepository chatRoomMemberRepository; + private final ChatMessageRepository chatMessageRepository; + private static final String EMPTY_MESSAGE = "채팅을 시작하지 않았습니다."; + private static final String OPEN_MESSAGE = "채팅을 시작해보세요!"; + + private List findAllChatRoomMemberBySenderId(Long memberId) { + return chatRoomMemberRepository.findAllBySenderId(memberId).orElse(new ArrayList<>()); + } + + private List findAllChatRoomMemberByReceiverId(Long memberId) { + return chatRoomMemberRepository.findAllByReceiverId(memberId).orElse(new ArrayList<>()); + } + + @Transactional + public Map getChatRoomList(Long memberId) { + + List chatRoomMemberList = new ArrayList<>(); + chatRoomMemberList.addAll(findAllChatRoomMemberByReceiverId(memberId)); + chatRoomMemberList.addAll(findAllChatRoomMemberBySenderId(memberId)); + + Map chatRooms = new HashMap<>(); + + if (chatRoomMemberList.isEmpty()) { + ChatRoomEmptyResponse chatRoomEmptyResponse = ChatRoomEmptyResponse.of(EMPTY_MESSAGE); + chatRooms.put("chatRoomList", chatRoomEmptyResponse); + return chatRooms; + } + + List chatRoomsMessage = new ArrayList<>(); + List chatRoomsHeart = new ArrayList<>(); + List chatRoomsOpen = new ArrayList<>(); + + for (ChatRoomMember chatRoomMember : chatRoomMemberList) { + ChatRoom.Status status = chatRoomMember.getChatRoom().getStatus(); + + if (status == ChatRoom.Status.set) { + GetSendHeartResponse sendHeartResponse = new GetSendHeartResponse(); + sendHeartResponse.setType("Heart"); + sendHeartResponse.setRoomId(chatRoomMember.getChatRoom().getId()); + sendHeartResponse.setSenderId(chatRoomMember.getSender().getId()); + sendHeartResponse.setReceiveId(chatRoomMember.getReceiver().getId()); + sendHeartResponse.setSenderName(chatRoomMember.getSender().getBasicInfo().getNickname()); + log.info("sendHeart:{}", sendHeartResponse.toString()); + ChatRoomHeartResponse chatRoomHeartResponse = ChatRoomHeartResponse.of(chatRoomMember, sendHeartResponse); + chatRoomsHeart.add(chatRoomHeartResponse); + + } else if (status == ChatRoom.Status.progress) { + ChatMessage chatMessage = chatMessageRepository.findFirstByChatRoomIdOrderBySendTimeDesc(chatRoomMember.getChatRoom().getId()); + ChatRoomMessageResponse chatRoomResponse = ChatRoomMessageResponse.of(chatRoomMember, chatMessage); + chatRoomsMessage.add(chatRoomResponse); + + } else if (status == ChatRoom.Status.open) { + Member Sender = chatRoomMember.getSender(); + ChatRoomOpenResponse chatRoomOpenResponse = ChatRoomOpenResponse.of(Sender.getId(), Sender.getBasicInfo().getNickname(), OPEN_MESSAGE); + chatRoomsOpen.add(chatRoomOpenResponse); + } + } + + chatRooms.put("chatRoomHeartList", chatRoomsHeart); + chatRooms.put("chatRoomMessageList", chatRoomsMessage); + chatRooms.put("chatRoomOpenList", chatRoomsOpen); + + return chatRooms; + } +} \ No newline at end of file From 131f137872e4ac1f176ffe976b12d28388bd8db4 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:57:51 +0900 Subject: [PATCH 17/37] =?UTF-8?q?Feat:=20=EC=B1=84=ED=8C=85=EB=B0=A9=20lis?= =?UTF-8?q?t=EB=A5=BC=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20controller?= =?UTF-8?q?=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/controller/ChatRoomController.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java b/src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java index 1d8d14d2f9..3ccfb34806 100644 --- a/src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java +++ b/src/main/java/capstone/facefriend/chat/controller/ChatRoomController.java @@ -1,11 +1,25 @@ package capstone.facefriend.chat.controller; +import capstone.facefriend.auth.controller.support.AuthMember; +import capstone.facefriend.chat.service.ChatRoomService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Map; + @RestController @Slf4j @RequiredArgsConstructor public class ChatRoomController { + private final ChatRoomService chatRoomService; + + @GetMapping("/room/list") + ResponseEntity> getChatRoomList( + @AuthMember Long memberId + ) { + return ResponseEntity.ok(chatRoomService.getChatRoomList(memberId)); + } } \ No newline at end of file From fd6e25bc06b381c13cd6382d9ba526aea8102adf Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:58:42 +0900 Subject: [PATCH 18/37] =?UTF-8?q?Feat:=20stomp=20=EC=99=B8=EB=B6=80?= =?UTF-8?q?=EB=B8=8C=EB=A1=9C=EC=BB=A4=20=EC=82=AC=EC=9A=A9=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20redis=20=EC=84=A4=EC=A0=95=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facefriend/chat/config/RedisConfig.java | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/config/RedisConfig.java diff --git a/src/main/java/capstone/facefriend/chat/config/RedisConfig.java b/src/main/java/capstone/facefriend/chat/config/RedisConfig.java new file mode 100644 index 0000000000..52fd742c81 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/config/RedisConfig.java @@ -0,0 +1,80 @@ +package capstone.facefriend.chat.config; + + +import capstone.facefriend.chat.service.RedisSubscriber; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisStandaloneConfiguration; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.ChannelTopic; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +@Configuration +@RequiredArgsConstructor +public class RedisConfig { + @Value("${spring.data.redis.host}") + private String redisHost; + @Value("${spring.data.redis.port}") + private int redisPort; + + + @Bean + public RedisConnectionFactory redisConnectionFactory() { + RedisStandaloneConfiguration redisStandaloneConfiguration = + new RedisStandaloneConfiguration(redisHost, redisPort); + return new LettuceConnectionFactory(redisStandaloneConfiguration); + } + + @Bean + public RedisMessageListenerContainer redisMessageListenerContainer( + RedisConnectionFactory connectionFactory, + MessageListenerAdapter listenerAdapter, + ChannelTopic channelTopic + ) { + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + container.setConnectionFactory(connectionFactory); + // RedisMessageListenerContainer 에 Bean 으로 등록한 listenerAdapter, channelTopic 추가 + container.addMessageListener(listenerAdapter, channelTopic); + return container; + } + + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { + RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setConnectionFactory(redisConnectionFactory); + + // Jackson2JsonRedisSerializer를 사용하여 RedisTemplate 설정 + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); // Java 8 시간 모듈 등록 + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); // 날짜를 타임스탬프로 변환하지 않도록 설정 + serializer.setObjectMapper(objectMapper); + + // 문자열 직렬화 설정 + redisTemplate.setKeySerializer(new StringRedisSerializer()); + redisTemplate.setValueSerializer(serializer); + + redisTemplate.afterPropertiesSet(); + return redisTemplate; + } + + @Bean + public MessageListenerAdapter listenerAdapter(RedisSubscriber subscriber) { + return new MessageListenerAdapter(subscriber, "sendMessage"); + } + + + @Bean + public ChannelTopic channelTopic() {return new ChannelTopic("chatroom");} + +} \ No newline at end of file From 0b9db392a401a886941e98638d0bc723373063f7 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 09:59:13 +0900 Subject: [PATCH 19/37] =?UTF-8?q?Feat:=20RedisSubscriber=20class=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../capstone/facefriend/chat/service/RedisSubscriber.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java diff --git a/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java new file mode 100644 index 0000000000..25b3394680 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java @@ -0,0 +1,4 @@ +package capstone.facefriend.chat.service; + +public class RedisSubscriber { +} From 5ca1edbd698cb8ef4afd625f8877003f48712082 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:05:02 +0900 Subject: [PATCH 20/37] =?UTF-8?q?Feat:=20message=20=EC=A0=84=EC=86=A1?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=ED=95=84=EC=9A=94=20dto=20cla?= =?UTF-8?q?ss=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/dto/message/MessageRequest.java | 14 +++++++++++ .../service/dto/message/MessageResponse.java | 24 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/message/MessageRequest.java create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java diff --git a/src/main/java/capstone/facefriend/chat/service/dto/message/MessageRequest.java b/src/main/java/capstone/facefriend/chat/service/dto/message/MessageRequest.java new file mode 100644 index 0000000000..a8b8222c4d --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/message/MessageRequest.java @@ -0,0 +1,14 @@ +package capstone.facefriend.chat.service.dto.message; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class MessageRequest { + private Long roomId; + + private Long receiveId; + + private String content; +} \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java new file mode 100644 index 0000000000..0a12830f2f --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java @@ -0,0 +1,24 @@ +package capstone.facefriend.chat.service.dto.message; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class MessageResponse implements Serializable { + private Long roomId; + private Long receiveId; + private Long senderId; + private String content; + private String type; + @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") + private LocalDateTime createdAt; + private Boolean isRead; +} \ No newline at end of file From 6d135bde01c97f1031c1ecc9acc52b9871f2dd82 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:05:24 +0900 Subject: [PATCH 21/37] =?UTF-8?q?Feat:=20message=20=EC=A0=84=EC=86=A1=20se?= =?UTF-8?q?rvice=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/service/MessageService.java | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/service/MessageService.java b/src/main/java/capstone/facefriend/chat/service/MessageService.java index f927460676..ef9de64b2a 100644 --- a/src/main/java/capstone/facefriend/chat/service/MessageService.java +++ b/src/main/java/capstone/facefriend/chat/service/MessageService.java @@ -1,11 +1,104 @@ package capstone.facefriend.chat.service; +import capstone.facefriend.chat.domain.ChatMessage; +import capstone.facefriend.chat.domain.ChatRoom; +import capstone.facefriend.chat.domain.ChatRoomMember; +import capstone.facefriend.chat.exception.ChatException; +import capstone.facefriend.chat.exception.ChatExceptionType; +import capstone.facefriend.chat.repository.ChatMessageRepository; +import capstone.facefriend.chat.repository.ChatRoomMemberRepository; +import capstone.facefriend.chat.repository.ChatRoomRepository; +import capstone.facefriend.chat.service.dto.message.MessageRequest; +import capstone.facefriend.chat.service.dto.message.MessageResponse; +import capstone.facefriend.member.domain.Member; +import capstone.facefriend.member.domain.MemberRepository; +import capstone.facefriend.member.exception.MemberException; +import capstone.facefriend.member.exception.MemberExceptionType; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.ChannelTopic; +import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; @Service @Slf4j @RequiredArgsConstructor public class MessageService { + + private final ChatMessageRepository chatMessageRepository; + private final ChatRoomMemberRepository chatRoomMemberRepository; + private final MemberRepository memberRepository; + private final ChatRoomRepository chatRoomRepository; + private final RedisTemplate redisTemplate; + private final ChannelTopic channelTopic; + private final SimpMessagingTemplate messagingTemplate; + + private Member findMemberById(Long memberId) { + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MemberException(MemberExceptionType.NOT_FOUND)); + return member; + } + + private ChatRoom findRoomById(Long roomId) { + ChatRoom chatRoom = chatRoomRepository.findById(roomId) + .orElseThrow(()-> new ChatException(ChatExceptionType.NOT_FOUND)); + return chatRoom; + } + + private ChatRoomMember findSenderReceiver(Long senderId, Long receiveId) { + ChatRoomMember chatRoomMember = chatRoomMemberRepository.findBySenderAndReceiver(senderId, receiveId) + .orElseThrow(()-> new ChatException(ChatExceptionType.NOT_FOUND)); + return chatRoomMember; + } + + + @Transactional + public void sendMessage(MessageRequest messageRequest, Long senderId) { + Member sender = findMemberById(senderId); + Member receiver = findMemberById(messageRequest.getReceiveId()); + ChatRoomMember chatRoomMember = findSenderReceiver(sender.getId(), receiver.getId()); + ChatRoom chatRoom = findRoomById(messageRequest.getRoomId()); + + if (chatRoom.getStatus() == ChatRoom.Status.open) { + chatRoom.setStatus(ChatRoom.Status.progress); + chatRoomRepository.save(chatRoom); + chatRoomMemberRepository.save(chatRoomMember); + } else if ((chatRoom.getStatus() == ChatRoom.Status.close)) { + throw new ChatException(ChatExceptionType.INVALIDED_CHATROOM); + } else if ((chatRoom.getStatus() == ChatRoom.Status.set)) { + throw new ChatException(ChatExceptionType.INVALIDED_CHATROOM); + } else if ((chatRoom.getStatus() == ChatRoom.Status.delete)) { + throw new ChatException(ChatExceptionType.INVALIDED_CHATROOM); + } + + + ChatMessage chatMessage = ChatMessage.builder() + .content(messageRequest.getContent()) + .sender(sender) + .chatRoom(chatRoom) + .sendTime(LocalDateTime.now()) + .isRead(false) + .build(); + + chatMessageRepository.save(chatMessage); + + MessageResponse messageResponse = new MessageResponse(); + messageResponse.setRoomId(chatMessage.getChatRoom().getId()); + messageResponse.setSenderId(senderId); + messageResponse.setReceiveId(receiver.getId()); + messageResponse.setContent(chatMessage.getContent()); + messageResponse.setType("message"); + messageResponse.setCreatedAt(chatMessage.getSendTime()); + messageResponse.setIsRead(chatMessage.isRead()); + + String topic = channelTopic.getTopic(); + + redisTemplate.convertAndSend(topic, messageResponse); + + } + } \ No newline at end of file From 2809e083f38d4e43be392b65513a847b3cb79041 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:05:33 +0900 Subject: [PATCH 22/37] =?UTF-8?q?Feat:=20message=20=EC=A0=84=EC=86=A1=20co?= =?UTF-8?q?ntroller=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/controller/MessageController.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/controller/MessageController.java b/src/main/java/capstone/facefriend/chat/controller/MessageController.java index 9dffed43d1..9d3ee29e2b 100644 --- a/src/main/java/capstone/facefriend/chat/controller/MessageController.java +++ b/src/main/java/capstone/facefriend/chat/controller/MessageController.java @@ -1,7 +1,17 @@ package capstone.facefriend.chat.controller; +import capstone.facefriend.auth.infrastructure.JwtProvider; +import capstone.facefriend.chat.service.dto.heart.HeartReplyRequest; +import capstone.facefriend.chat.service.dto.message.MessageRequest; +import capstone.facefriend.chat.service.dto.heart.SendHeartRequest; +import capstone.facefriend.chat.service.MessageService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.messaging.handler.annotation.SendTo; +import org.springframework.messaging.simp.stomp.StompHeaderAccessor; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @RestController @@ -9,4 +19,31 @@ @RequiredArgsConstructor public class MessageController { + private static final String BEARER_PREFIX = "Bearer "; + private final MessageService messageService; + private final MappingJackson2HttpMessageConverter converter; + private final JwtProvider jwtProvider; + + @MessageMapping("/test") + @SendTo("/sub/test") + public String test() { + return "테스트 메시지"; + } + + @MessageMapping("/chat/messages") + public void message( + StompHeaderAccessor headerAccessor, + MessageRequest messageRequest + ) { + String authorizationHeader = headerAccessor.getFirstNativeHeader("Authorization"); + String token = authorizationHeader.substring(BEARER_PREFIX.length()); + log.info("token: {}",token); + Long senderId = jwtProvider.extractId(token); + log.info("senderId: {}",senderId.toString()); + String destination = headerAccessor.getDestination(); + messageService.sendMessage(messageRequest, senderId); + } + + + } \ No newline at end of file From 4115ae3abafd29878dab172829c5c5d8f4b576fa Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:05:58 +0900 Subject: [PATCH 23/37] =?UTF-8?q?Feat:=20message=20=EC=A0=84=EC=86=A1=20se?= =?UTF-8?q?rvice=EC=97=90=EC=84=9C=20=EC=93=B0=EC=9D=B4=EB=8A=94=20jpa=20m?= =?UTF-8?q?ethod=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/repository/ChatMessageRepository.java | 1 + .../chat/repository/ChatRoomMemberRepository.java | 11 +++++++++++ .../chat/repository/ChatRoomRepository.java | 10 ++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java index b4ed24bbb5..f6a20281f5 100644 --- a/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java +++ b/src/main/java/capstone/facefriend/chat/repository/ChatMessageRepository.java @@ -6,5 +6,6 @@ public interface ChatMessageRepository extends JpaRepository { ChatMessage findFirstByChatRoomIdOrderBySendTimeDesc(Long roomId); + ChatMessage save(ChatMessage chatMessage); } \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java index f93f7aa943..7cb178a2ad 100644 --- a/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java +++ b/src/main/java/capstone/facefriend/chat/repository/ChatRoomMemberRepository.java @@ -1,12 +1,23 @@ package capstone.facefriend.chat.repository; +import capstone.facefriend.chat.domain.ChatRoom; import capstone.facefriend.chat.domain.ChatRoomMember; +import io.lettuce.core.dynamic.annotation.Param; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import java.util.List; import java.util.Optional; public interface ChatRoomMemberRepository extends JpaRepository { + Optional findByChatRoom(ChatRoom chatRoom); + + @Query("SELECT c FROM ChatRoomMember c WHERE c.sender.id = :senderId AND c.receiver.id = :receiverId") + Optional findBySenderAndReceiver(@Param("senderId") Long senderId, @Param("receiverId") Long receiverId); + + // Optional findChatRoomMemberBySenderAAndReceiver(Member sender, Member receiver); + ChatRoomMember save(ChatRoomMember chatRoomMember); + Optional> findAllBySenderId(Long senderId); Optional> findAllByReceiverId(Long senderId); } \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java b/src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java index 62a8e94d7c..8a7da8f716 100644 --- a/src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java +++ b/src/main/java/capstone/facefriend/chat/repository/ChatRoomRepository.java @@ -1,4 +1,10 @@ package capstone.facefriend.chat.repository; -public interface ChatRoomRepository { -} +import capstone.facefriend.chat.domain.ChatRoom; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; +public interface ChatRoomRepository extends JpaRepository { + Optional findById(Long id); + ChatRoom save(ChatRoom chatRoom); +} \ No newline at end of file From 2b508855b532a98ee88dafc3420351fa66919765 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:06:27 +0900 Subject: [PATCH 24/37] =?UTF-8?q?Feat:=20message=20=EC=A0=84=EC=86=A1=20se?= =?UTF-8?q?rvice=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20exception=20class=20=EB=B0=8F=20enum=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/exception/ChatException.java | 10 ++++ .../chat/exception/ChatExceptionType.java | 46 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/exception/ChatException.java create mode 100644 src/main/java/capstone/facefriend/chat/exception/ChatExceptionType.java diff --git a/src/main/java/capstone/facefriend/chat/exception/ChatException.java b/src/main/java/capstone/facefriend/chat/exception/ChatException.java new file mode 100644 index 0000000000..d82e698859 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/exception/ChatException.java @@ -0,0 +1,10 @@ +package capstone.facefriend.chat.exception; + +import capstone.facefriend.common.exception.BaseException; +import capstone.facefriend.common.exception.ExceptionType; + +public class ChatException extends BaseException { + public ChatException(ExceptionType exceptionType) { + super(exceptionType); + } +} \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/exception/ChatExceptionType.java b/src/main/java/capstone/facefriend/chat/exception/ChatExceptionType.java new file mode 100644 index 0000000000..afea94e745 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/exception/ChatExceptionType.java @@ -0,0 +1,46 @@ +package capstone.facefriend.chat.exception; + +import capstone.facefriend.common.exception.ExceptionType; +import capstone.facefriend.common.exception.Status; + +public enum ChatExceptionType implements ExceptionType { + NOT_FOUND(Status.NOT_FOUND, 5001, "일치하는 채팅방이 없습니다."), + INVALIDED_CHATROOM(Status.BAD_REQUEST, 5002, "유효한 채팅방이 아닙니다"), + INVALID_ACCESS(Status.FORBIDDEN, 5003, "본인의 계정이 아닙니다."), + UNAUTHORIZED(Status.UNAUTHORIZED, 5005, "접근 정보가 잘못되었습니다."), + ALREADY_CHATROOM(Status.BAD_REQUEST, 5006, "이미 존재하는 채팅방입니다."), + WRONG_PASSWORD(Status.BAD_REQUEST, 5007, "잘못된 비밀번호입니다."), + EXPIRED_ACCESS_TOKEN(Status.BAD_REQUEST, 5008, "만료된 액세스 토큰이므로 재발급해야 합니다."), + INVALID_ACCESS_TOKEN(Status.BAD_REQUEST, 5009, "유효하지 않은 액세스 토큰이므로 재발급해야 합니다."), + INVALID_REFRESH_TOKEN(Status.BAD_REQUEST, 5010, "유효하지 않은 리프레시 토큰입니다. 토큰 재발급이 불가능합니다."), + ACCESS_TOKEN_IS_IN_BLACKLIST(Status.BAD_REQUEST, 5011, "액세스 토큰이 로그아웃 처리되었습니다. 재로그인하시기 바랍니다."), + NOT_VERIFIED(Status.BAD_REQUEST, 5012, "본인 인증을 먼저 완료해야 합니다."), + PASSWORDS_NOT_EQUAL(Status.BAD_REQUEST, 5013, "재설정하는 비밀번호들이 동일하지 않습니다."), + WRONG_TEMPORARY_PASSWORD(Status.BAD_REQUEST, 5014, "임시 비밀번호가 올바르지 않습니다."), + NOT_FOUND_GENDER(Status.NOT_FOUND, 5015, "일치하는 성별이 없습니다.") + ; + private final Status status; + private final int exceptionCode; + private final String message; + + ChatExceptionType(Status status, int exceptionCode, String message) { + this.status = status; + this.exceptionCode = exceptionCode; + this.message = message; + } + + @Override + public Status status() { + return status; + } + + @Override + public int exceptionCode() { + return exceptionCode; + } + + @Override + public String message() { + return message; + } +} \ No newline at end of file From c82968f521652f7835fb29db13336dea219ae13b Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:08:05 +0900 Subject: [PATCH 25/37] =?UTF-8?q?Feat:=20RedisSubscriber=EB=A5=BC=20?= =?UTF-8?q?=ED=86=B5=ED=95=B4=20=EC=99=B8=EB=B6=80=20=EB=B8=8C=EB=A1=9C?= =?UTF-8?q?=EC=BB=A4=EB=A1=9C=EB=B6=80=ED=84=B0=20=EB=B0=9B=EC=9D=80=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=EB=A5=BC=20destination=EC=97=90=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/service/RedisSubscriber.java | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java index 25b3394680..7f578c8839 100644 --- a/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java +++ b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java @@ -1,4 +1,50 @@ package capstone.facefriend.chat.service; -public class RedisSubscriber { -} +import capstone.facefriend.chat.service.dto.message.GetMessageResponse; +import capstone.facefriend.chat.service.dto.heart.GetSendHeartResponse; +import capstone.facefriend.chat.service.dto.message.MessageResponse; +import capstone.facefriend.chat.service.dto.heart.SendHeartResponse; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.connection.Message; +import org.springframework.data.redis.connection.MessageListener; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.messaging.simp.SimpMessageSendingOperations; +import org.springframework.stereotype.Service; + +import java.io.IOException; + +@Slf4j +@RequiredArgsConstructor +@Service +public class RedisSubscriber implements MessageListener { + + private final ObjectMapper objectMapper; + private final RedisTemplate redisTemplate; + private final SimpMessageSendingOperations messagingTemplate; + + @Override + public void onMessage(Message message, byte[] pattern) { + try { + + // redis에서 발행된 데이터를 받아 역직렬화 + String publishMessage = (String) redisTemplate.getStringSerializer().deserialize(message.getBody()); + + log.info("Received message from Redis: {}", publishMessage); // 메시지 내용 로깅 + + if (publishMessage.contains("message")) { + MessageResponse messageResponse = objectMapper.readValue(publishMessage, MessageResponse.class); + + log.info("Received message: {}", messageResponse.toString()); // message 보내지는 지 확인 + + GetMessageResponse chatMessageResponse = new GetMessageResponse(messageResponse); + + messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getReceiveId(), chatMessageResponse); + + } + } catch (IOException e) { + throw new RuntimeException("Failed to process message", e); + } + } +} \ No newline at end of file From 5b8ffb6e74c218b56ce41421d6804657d4f181f9 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:09:03 +0900 Subject: [PATCH 26/37] =?UTF-8?q?Feat:=20RedisSubscriber=EC=97=90=EC=84=9C?= =?UTF-8?q?=20destination=EC=9C=BC=EB=A1=9C=20=EB=B3=B4=EB=82=B4=EC=A7=80?= =?UTF-8?q?=EB=8A=94=20dto=20class=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/message/GetMessageResponse.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java diff --git a/src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java new file mode 100644 index 0000000000..04749cab84 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java @@ -0,0 +1,31 @@ +package capstone.facefriend.chat.service.dto.message; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + + +@Data +@NoArgsConstructor +public class GetMessageResponse { + private Long roomId; + private Long senderId; + private Long receiveId; + private String type; + private String content; + @JsonFormat(pattern = "yyyy-MM-dd hh:mm", timezone = "Asia/Seoul") + private LocalDateTime createdAt; + private Boolean isRead; + + public GetMessageResponse(MessageResponse messageResponse) { + this.roomId = messageResponse.getRoomId(); + this.senderId = messageResponse.getSenderId(); + this.receiveId = messageResponse.getReceiveId(); + this.type = messageResponse.getType(); + this.content = messageResponse.getContent(); + this.createdAt = LocalDateTime.now(); + this.isRead = messageResponse.getIsRead(); + } +} \ No newline at end of file From b9f2fe944ffc06fc37245adef08d7aed9f5bcf56 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:11:42 +0900 Subject: [PATCH 27/37] =?UTF-8?q?Feat:=20=EB=8C=80=ED=99=94=EB=A5=BC=20?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=ED=95=98=EB=8A=94=20Sendheart=20service=20me?= =?UTF-8?q?thod=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/service/MessageService.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/service/MessageService.java b/src/main/java/capstone/facefriend/chat/service/MessageService.java index ef9de64b2a..7e8f497b58 100644 --- a/src/main/java/capstone/facefriend/chat/service/MessageService.java +++ b/src/main/java/capstone/facefriend/chat/service/MessageService.java @@ -8,6 +8,8 @@ import capstone.facefriend.chat.repository.ChatMessageRepository; import capstone.facefriend.chat.repository.ChatRoomMemberRepository; import capstone.facefriend.chat.repository.ChatRoomRepository; +import capstone.facefriend.chat.service.dto.heart.HeartReplyRequest; +import capstone.facefriend.chat.service.dto.heart.SendHeartResponse; import capstone.facefriend.chat.service.dto.message.MessageRequest; import capstone.facefriend.chat.service.dto.message.MessageResponse; import capstone.facefriend.member.domain.Member; @@ -100,5 +102,47 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) { redisTemplate.convertAndSend(topic, messageResponse); } + @Transactional + public void sendHeart(Long senderId, Long receiveId) { + + + ChatRoom chatRoom = ChatRoom.builder() + .status(ChatRoom.Status.set) + .isPublic(false) + .build(); + chatRoomRepository.save(chatRoom); + + Member sender = findMemberById(senderId); + Member receiver = findMemberById(receiveId); + + + if (chatRoomMemberRepository.findBySenderAndReceiver(senderId, receiveId).isPresent()) + throw new ChatException(ChatExceptionType.ALREADY_CHATROOM); + + + ChatRoomMember chatRoomMember = ChatRoomMember.builder() + .chatRoom(chatRoom) + .sender(sender) + .receiver(receiver) + .isSenderExist(false) + .isReceiverExist(false) + .isSenderPublic(false) + .isReceiverPublic(false) + .build(); + + chatRoomMemberRepository.save(chatRoomMember); + + SendHeartResponse sendHeartResponse = new SendHeartResponse(); + sendHeartResponse.setRoomId(chatRoom.getId()); + sendHeartResponse.setSenderId(sender.getId()); + sendHeartResponse.setReceiveId(receiveId); + sendHeartResponse.setSenderName(sender.getBasicInfo().getNickname()); + sendHeartResponse.setCreatedAt(LocalDateTime.now()); + sendHeartResponse.setType("Heart"); + + String topic = channelTopic.getTopic(); + log.info("-------------------send-heart---------------"); + redisTemplate.convertAndSend(topic, sendHeartResponse); + } } \ No newline at end of file From 3134d73a7fd67fbc507e552c600cec75dd455eee Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:12:01 +0900 Subject: [PATCH 28/37] =?UTF-8?q?Feat:=20=EB=8C=80=ED=99=94=EB=A5=BC=20?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=ED=95=98=EB=8A=94=20Sendheart=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20dto=20class=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/dto/heart/SendHeartRequest.java | 10 +++++++++ .../service/dto/heart/SendHeartResponse.java | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartRequest.java create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartResponse.java diff --git a/src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartRequest.java b/src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartRequest.java new file mode 100644 index 0000000000..d572e66238 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartRequest.java @@ -0,0 +1,10 @@ +package capstone.facefriend.chat.service.dto.heart; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class SendHeartRequest { + private Long receiveId; +} \ No newline at end of file diff --git a/src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartResponse.java new file mode 100644 index 0000000000..438e842d61 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/heart/SendHeartResponse.java @@ -0,0 +1,22 @@ +package capstone.facefriend.chat.service.dto.heart; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.*; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class SendHeartResponse implements Serializable { + private Long roomId; + private Long senderId; + private Long receiveId; + private String senderName; + private String type; + private String sessionId; + @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") + private LocalDateTime createdAt; + +} \ No newline at end of file From 571719d5195288f6bfe8c8ecec08a99ca82ce577 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:13:17 +0900 Subject: [PATCH 29/37] =?UTF-8?q?Feat:=20controller=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=99=94=EB=A5=BC=20=EC=9A=94=EC=B2=AD=ED=95=98=EB=8A=94=20Sen?= =?UTF-8?q?dheart=20mapping=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/controller/MessageController.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/controller/MessageController.java b/src/main/java/capstone/facefriend/chat/controller/MessageController.java index 9d3ee29e2b..af93ca8a99 100644 --- a/src/main/java/capstone/facefriend/chat/controller/MessageController.java +++ b/src/main/java/capstone/facefriend/chat/controller/MessageController.java @@ -44,6 +44,21 @@ public void message( messageService.sendMessage(messageRequest, senderId); } + @MessageMapping("/chat/send-heart") + public void sendheart( + StompHeaderAccessor headerAccessor, + @RequestBody SendHeartRequest sendHeartRequest + ){ + String authorizationHeader = headerAccessor.getFirstNativeHeader("Authorization"); + String token = authorizationHeader.substring(BEARER_PREFIX.length()); + log.info("token: {}",token); + Long senderId = jwtProvider.extractId(token); + log.info("senderId: {}",senderId.toString()); + String destination = headerAccessor.getDestination(); + messageService.sendHeart(senderId, sendHeartRequest.getReceiveId()); + } + + } \ No newline at end of file From 47514aa6a45819fd6c12b0a1f45eca40803375b5 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:14:18 +0900 Subject: [PATCH 30/37] =?UTF-8?q?Feat:=20type=20=EB=94=B0=EB=9D=BC=20?= =?UTF-8?q?=EC=A0=84=EC=86=A1=ED=95=98=EB=8A=94=20=EA=B0=9D=EC=B2=B4?= =?UTF-8?q?=EB=A5=BC=20=EB=B0=94=EA=BE=B8=EB=8A=94=20subscribe=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../capstone/facefriend/chat/service/RedisSubscriber.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java index 7f578c8839..08138b79ad 100644 --- a/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java +++ b/src/main/java/capstone/facefriend/chat/service/RedisSubscriber.java @@ -42,6 +42,12 @@ public void onMessage(Message message, byte[] pattern) { messagingTemplate.convertAndSend("/sub/chat/" + messageResponse.getReceiveId(), chatMessageResponse); + } else if (publishMessage.contains("Heart")) { + SendHeartResponse sendHeartResponse = objectMapper.readValue(publishMessage, SendHeartResponse.class); + + GetSendHeartResponse chatSendHeartResponse = new GetSendHeartResponse(sendHeartResponse); + + messagingTemplate.convertAndSend("/sub/chat/" + sendHeartResponse.getReceiveId(), chatSendHeartResponse); } } catch (IOException e) { throw new RuntimeException("Failed to process message", e); From fd974c77caf9390b91d1c1a525d93b325236a563 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:16:14 +0900 Subject: [PATCH 31/37] =?UTF-8?q?Feat:=20=EB=8C=80=ED=99=94=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD/=EA=B1=B0=EC=A0=88=EC=97=90=20=EB=8C=80=ED=95=9C=20se?= =?UTF-8?q?rvice=20method=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/service/MessageService.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/service/MessageService.java b/src/main/java/capstone/facefriend/chat/service/MessageService.java index 7e8f497b58..c3eb0752b4 100644 --- a/src/main/java/capstone/facefriend/chat/service/MessageService.java +++ b/src/main/java/capstone/facefriend/chat/service/MessageService.java @@ -144,5 +144,34 @@ public void sendHeart(Long senderId, Long receiveId) { log.info("-------------------send-heart---------------"); redisTemplate.convertAndSend(topic, sendHeartResponse); } + @Transactional + public void heartReply(HeartReplyRequest heartReplyRequest, Long receiveId) { + String message = null; + + Member receiver = findMemberById(receiveId); + Member sender = findMemberById(heartReplyRequest.getSenderId()); + ChatRoomMember chatRoomMember = findSenderReceiver(sender.getId(), receiver.getId()); + ChatRoom chatRoom = findRoomById(chatRoomMember.getChatRoom().getId()); + + if (heartReplyRequest.getIntention().equals("positive")) { + chatRoom.setStatus(ChatRoom.Status.open); + chatRoomRepository.save(chatRoom); + chatRoomMemberRepository.save(chatRoomMember); + + message = receiver.getBasicInfo().getNickname() + "님이 수락했습니다."; + } else if (heartReplyRequest.getIntention().equals("negative")) { + chatRoomMemberRepository.delete(chatRoomMember); + chatRoomRepository.delete(chatRoom); + + message = receiver.getBasicInfo().getNickname() + "님이 거절했습니다."; + } else { + throw new ChatException(ChatExceptionType.ALREADY_CHATROOM); + } + // 동적으로 목적지 설정 + String destination = "/sub/chat/" + sender.getId(); + + // 메시지 전송 + messagingTemplate.convertAndSend(destination, message); + } } \ No newline at end of file From 57660d0aceb678e2da269347bb1ece94eef539d4 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:16:26 +0900 Subject: [PATCH 32/37] =?UTF-8?q?Feat:=20=EB=8C=80=ED=99=94=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD/=EA=B1=B0=EC=A0=88=EC=97=90=20=EB=8C=80=ED=95=9C=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=20dto=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/service/dto/heart/HeartReplyRequest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/java/capstone/facefriend/chat/service/dto/heart/HeartReplyRequest.java diff --git a/src/main/java/capstone/facefriend/chat/service/dto/heart/HeartReplyRequest.java b/src/main/java/capstone/facefriend/chat/service/dto/heart/HeartReplyRequest.java new file mode 100644 index 0000000000..22b42fdfa4 --- /dev/null +++ b/src/main/java/capstone/facefriend/chat/service/dto/heart/HeartReplyRequest.java @@ -0,0 +1,11 @@ +package capstone.facefriend.chat.service.dto.heart; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class HeartReplyRequest { + Long senderId; + String intention; +} \ No newline at end of file From a9de68b4efd98f9959feb05747ad015d7656ecd6 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 10:16:58 +0900 Subject: [PATCH 33/37] =?UTF-8?q?Feat:=20controller=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=99=94=20=EC=9A=94=EC=B2=AD/=EA=B1=B0=EC=A0=88=20mapping=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/controller/MessageController.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/capstone/facefriend/chat/controller/MessageController.java b/src/main/java/capstone/facefriend/chat/controller/MessageController.java index af93ca8a99..9ff7558b7b 100644 --- a/src/main/java/capstone/facefriend/chat/controller/MessageController.java +++ b/src/main/java/capstone/facefriend/chat/controller/MessageController.java @@ -58,7 +58,18 @@ public void sendheart( messageService.sendHeart(senderId, sendHeartRequest.getReceiveId()); } + @MessageMapping("/chat/heart-reply") + public void heartreply( + StompHeaderAccessor headerAccessor, + HeartReplyRequest heartReplyRequest + ) { + String authorizationHeader = headerAccessor.getFirstNativeHeader("Authorization"); + String token = authorizationHeader.substring(BEARER_PREFIX.length()); + log.info("token: {}",token); + Long receiveId = jwtProvider.extractId(token); + log.info("receiveId: {}",receiveId.toString()); - + messageService.heartReply(heartReplyRequest, receiveId); + } } \ No newline at end of file From 974fd5456025a0d8ace3368fed77a74fdac29926 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 11:11:29 +0900 Subject: [PATCH 34/37] =?UTF-8?q?Feat:=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20response=20d?= =?UTF-8?q?to=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facefriend/chat/service/dto/message/GetMessageResponse.java | 2 ++ .../facefriend/chat/service/dto/message/MessageResponse.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java index 04749cab84..2b80749085 100644 --- a/src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java +++ b/src/main/java/capstone/facefriend/chat/service/dto/message/GetMessageResponse.java @@ -13,6 +13,7 @@ public class GetMessageResponse { private Long roomId; private Long senderId; private Long receiveId; + private String senderNickname; private String type; private String content; @JsonFormat(pattern = "yyyy-MM-dd hh:mm", timezone = "Asia/Seoul") @@ -23,6 +24,7 @@ public GetMessageResponse(MessageResponse messageResponse) { this.roomId = messageResponse.getRoomId(); this.senderId = messageResponse.getSenderId(); this.receiveId = messageResponse.getReceiveId(); + this.senderNickname = messageResponse.getSenderNickname(); this.type = messageResponse.getType(); this.content = messageResponse.getContent(); this.createdAt = LocalDateTime.now(); diff --git a/src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java b/src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java index 0a12830f2f..cb55138300 100644 --- a/src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java +++ b/src/main/java/capstone/facefriend/chat/service/dto/message/MessageResponse.java @@ -18,6 +18,7 @@ public class MessageResponse implements Serializable { private Long senderId; private String content; private String type; + private String senderNickname; @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") private LocalDateTime createdAt; private Boolean isRead; From cb487954dea03957734f312ccc7c49fcf41696d2 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 11:12:00 +0900 Subject: [PATCH 35/37] =?UTF-8?q?Feat:=20service=20method=EC=97=90=20?= =?UTF-8?q?=EB=8B=89=EB=84=A4=EC=9E=84=EB=8F=84=20=EA=B0=99=EC=9D=B4=20?= =?UTF-8?q?=EB=B3=B4=EB=82=B4=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/capstone/facefriend/chat/service/MessageService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/capstone/facefriend/chat/service/MessageService.java b/src/main/java/capstone/facefriend/chat/service/MessageService.java index c3eb0752b4..b8495494e6 100644 --- a/src/main/java/capstone/facefriend/chat/service/MessageService.java +++ b/src/main/java/capstone/facefriend/chat/service/MessageService.java @@ -92,6 +92,7 @@ public void sendMessage(MessageRequest messageRequest, Long senderId) { messageResponse.setRoomId(chatMessage.getChatRoom().getId()); messageResponse.setSenderId(senderId); messageResponse.setReceiveId(receiver.getId()); + messageResponse.setSenderNickname(sender.getBasicInfo().getNickname()); messageResponse.setContent(chatMessage.getContent()); messageResponse.setType("message"); messageResponse.setCreatedAt(chatMessage.getSendTime()); From e321f4aec248cf0ea23d3e30b4ac91412d016722 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 11:13:49 +0900 Subject: [PATCH 36/37] =?UTF-8?q?Chore:=20dev=20application.yml=20?= =?UTF-8?q?=EC=95=88=EC=98=AC=EB=9D=BC=EA=B0=80=EA=B2=8C=20ignore=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1a6145ee49..6fcbd2dd3a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,11 @@ # Gradle .idea/**/gradle.xml .idea/**/libraries +gradle/caches +gradle/.tmp +gradle/daemon +gradle/jdks +gradle/native # Gradle and Maven with auto-import # When using Gradle or Maven with auto-import, you should exclude module files, @@ -286,8 +291,4 @@ gradle-app.setting # End of https://www.toptal.com/developers/gitignore/api/java,intellij,gradle,macos,windows,intellij+all -gradle/caches -gradle/.tmp -gradle/daemon -gradle/jdks -gradle/native \ No newline at end of file +application-dev.yml \ No newline at end of file From 0c893fed5e45675e3cfad864e901604e6ba967d3 Mon Sep 17 00:00:00 2001 From: imjanghyeok Date: Fri, 3 May 2024 11:14:24 +0900 Subject: [PATCH 37/37] =?UTF-8?q?Chore:=20dev,=20prod=20=EA=B5=AC=EB=B6=84?= =?UTF-8?q?=20=EB=B0=8F=20=EC=A3=BC=EC=84=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../capstone/facefriend/config/JasyptConfig.java | 2 ++ src/main/resources/application.yml | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/capstone/facefriend/config/JasyptConfig.java b/src/main/java/capstone/facefriend/config/JasyptConfig.java index b6d75f11a2..3c95b047f3 100644 --- a/src/main/java/capstone/facefriend/config/JasyptConfig.java +++ b/src/main/java/capstone/facefriend/config/JasyptConfig.java @@ -6,8 +6,10 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; @Configuration +@Profile({"prod"}) // profile 설정을 통해 prod, dev를 구분 public class JasyptConfig { @Value("${jasypt.encryptor.password}") diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 43a857c01b..92d6385fe5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,4 +1,11 @@ -jasypt: - encryptor: - bean: jasyptStringEncryptor - password: ${ENCRYPT_KEY} \ No newline at end of file +#production에서 실행할 때 +#jasypt: +# encryptor: +# bean: jasyptStringEncryptor +# password: ${ENCRYPT_KEY} + + +# local에서 실행할 때 +spring: + profiles: + active: dev \ No newline at end of file