Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

로그인, 소모임 승인, 반려 #4

Merged
merged 39 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4013ad3
[backend] feat: .gitignore 추가
minsu20 Nov 12, 2023
b435c7f
[backend] feat: build.gradle 추가
minsu20 Nov 12, 2023
6c73218
[backend] feat: 공통 에러 처리 추가
minsu20 Nov 12, 2023
d8f3737
[backend] feat: security, jwt 설정 추가
minsu20 Nov 12, 2023
db4ab4f
[backend] feat: redis 설정 추가
minsu20 Nov 12, 2023
14ad714
[backend] feat: ApplicationTest 어노테이션 삭제
minsu20 Nov 12, 2023
360b8e1
[backend] feat: 공통 엔티티 추가
minsu20 Nov 12, 2023
0603070
[backend] feat: 어노테이션 설정 추가
minsu20 Nov 12, 2023
d5226d9
[backend] feat: 로그인, 회원가입 에러 설정 추가
minsu20 Nov 12, 2023
45a7fc3
[backend] feat: Admin 엔티티 추가
minsu20 Nov 12, 2023
daaffb0
[backend] feat: Admin 레포지토리 추가
minsu20 Nov 12, 2023
0ad5809
[backend] feat: 관리자 회원가입,로그인 기능 추가
minsu20 Nov 12, 2023
f482960
[backend] feat: 아이디 중복 체크 추가
minsu20 Nov 12, 2023
e764569
[backend] feat: Team 엔티티 추가
minsu20 Nov 12, 2023
be304ae
Merge pull request #1 from Modagbul/backend_auth
minsu20 Nov 12, 2023
e1fa6bd
Merge branch 'backend_main' of https://github.com/Modagbul/MOING_Admi…
minsu20 Nov 12, 2023
866700a
Merge branch 'main' into backend_main
minsu20 Nov 12, 2023
35ee3e2
[backend] fix: Dockerfile 수정
minsu20 Nov 12, 2023
dc387ef
[backend] fix: deploy.sh 수정
minsu20 Nov 12, 2023
2e59c28
[backend] fix: deploy.sh 수정
minsu20 Nov 12, 2023
28f50ee
[backend] fix: deploy.sh 수정
minsu20 Nov 12, 2023
1a64c93
[backend] refactor: 승인상태 ApprovalStatus로 통합
minsu20 Nov 12, 2023
0534e17
deploy: Update Dockerfile
minsu20 Dec 2, 2023
cff84c9
feat: fcm 설정
minsu20 Dec 2, 2023
be19ca2
refactor: response 레코드로 수정
minsu20 Dec 2, 2023
0a1f73b
feat: Member 도메인 추가
minsu20 Dec 2, 2023
9bbe1f4
feat: 소모임 승인, 반려 로직 추가
minsu20 Dec 2, 2023
28bbf2c
feat: converter 설정 추가
minsu20 Dec 2, 2023
9aa54bd
fix: config 수정
minsu20 Dec 2, 2023
2948380
fix: 중복 삭제
minsu20 Dec 2, 2023
371628d
feat: Rest docs 추가
minsu20 Dec 2, 2023
e7db4d7
deploy: Update backend-cicd.yml
minsu20 Dec 2, 2023
063d86b
Merge pull request #2 from Modagbul/backend_team
minsu20 Dec 2, 2023
94ce784
deploy: Update Dockerfile
minsu20 Dec 2, 2023
83f88b4
deploy: Update Dockerfile
minsu20 Dec 2, 2023
4700869
deploy: Update backend-cicd.yml
minsu20 Dec 2, 2023
cbcced4
deploy: Update Dockerfile
minsu20 Dec 2, 2023
f0b8874
refactor: adoc 파일 수정
minsu20 Dec 2, 2023
72ed28a
Merge pull request #3 from Modagbul/backend_team
minsu20 Dec 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/backend-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
working-directory: ./backend
APPLICATION: ${{ secrets.APPLICATION }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
APPLE_KEY: ${{ secrets.APPLE_KEY }}

steps:
# 소스 코드 체크아웃
Expand Down Expand Up @@ -44,13 +43,20 @@ jobs:
cd ./backend/src/main/resources
touch ./application.yml
echo "${{env.APPLICATION}}" > ./application.yml
touch ./firebase-key.json
echo "${{env.GOOGLE_APPLICATION_CREDENTIALS}}" | base64 --decode > ./firebase-key.json

# 설정 파일을 작업공간에 저장
- uses: actions/upload-artifact@v2
with:
name: application.yml
path: ./backend/src/main/resources/application.yml

- uses: actions/upload-artifact@v2
with:
name: firebase-key.json
path: ./backend/src/main/resources/firebase-key.json

# gradlew 권한 설정
- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM openjdk:17-jdk
ARG JAR_FILE=./build/libs/dashboardback-0.0.1-SNAPSHOT.jar
ARG JAR_FILE=./backend/build/libs/backend-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

# 문서를 이미지의 /static/docs 디렉토리에 복사
COPY ./backend/build/docs/asciidoc/*.html /static/docs/

# 애플리케이션 실행 시 -cp 옵션을 사용하여 /static/docs 디렉토리를 클래스패스에 추가
ENTRYPOINT ["java","-cp",".:/static/docs","-jar","/app.jar"]


6 changes: 5 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build/
!**/src/test/**/build/

### STS ###
.apt_generated
.apt_generate
.classpath
.factorypath
.project
Expand Down Expand Up @@ -37,3 +37,7 @@ out/
.vscode/

.DS_Store
application.yml

### Querydsl ###
src/main/generated/
82 changes: 79 additions & 3 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
id "org.asciidoctor.jvm.convert" version "3.3.2"
}

group = 'com.moing.bo.'
Expand All @@ -12,24 +13,99 @@ java {
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
asciidoctorExt
}

repositories {
mavenCentral()
}

bootJar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.security:spring-security-test'
implementation 'org.springframework.boot:spring-boot-starter-security'


//jwt
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'

// Qeurydsl
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

// Redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

// Fcm
implementation 'com.google.firebase:firebase-admin:8.2.0'


implementation 'org.springframework.retry:spring-retry:2.0.4'

// RestDocs
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor' // (3)
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' // (4)


}

tasks.named('test') {
useJUnitPlatform()
}

//querydsl
def querydslSrcDir = 'src/main/generated'
clean {
delete file(querydslSrcDir)
}
tasks.withType(JavaCompile) {
options.generatedSourceOutputDirectory = file(querydslSrcDir)
}

//Rest docs
ext {
snippetsDir = file('build/generated-snippets') // (5)
}

tasks.named('test') {
useJUnitPlatform()
outputs.dir snippetsDir // (6)
}

asciidoctor {
configurations 'asciidoctorExt' // (7)
baseDirFollowsSourceFile() // (8)
inputs.dir snippetsDir // (9)
dependsOn test // (10)
}

asciidoctor.doFirst {
delete file('src/main/resources/static/docs') // (11)
}

task copyDocument(type: Copy) { // (12)
dependsOn asciidoctor
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}

build {
dependsOn copyDocument
}
6 changes: 6 additions & 0 deletions backend/src/docs/asciidoc/Admin-API.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[Admin-API]]
= Admin API

[[Admin-로그인]]
== Admin 로그인
operation::admin-controller-test/sign_in[snippets='http-request,request-fields,http-response,response-fields']
61 changes: 61 additions & 0 deletions backend/src/docs/asciidoc/Overview.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[[Overview-Response]]
== ErrorCode


=== Error Response DTO
|===
| isSuccess(Boolean) | timeStamp(LocalDateTime) | errorCode(String) | message(String)
|===

=== Common ErrorCode
|===
| ErrorCode | Scope | Description

| `400`
| 전체
| 요청 형식 자체가 틀리거나 권한이 없음

| `403`
| 전체
| 접근 권한이 존재하지 않음 (로그인 안한 경우)

| `405`
| 전체
| HTTP 메서드가 리소스에서 허용되지 않음

| `500`
| 전체
| 서버오류

| `J0001`
| 전체
| 예상치 못한 오류

| `J0002`
| 전체
| 잘못된 JWT 서명

|`J0003`
| 전체
| 만료된 토큰

| `J0004`
| 전체
| 지원되지 않는 토큰

| `J0005`
| 전체
| 접근이 거부됨

| `J0006`
| 전체
| 토큰이 잘못됨

| `J0007`
| 전체
| 추가 정보 입력 (닉네임) 안함

| `J0008`
| 재발급 시
| 유효하지 않은 refresh Token
|===
37 changes: 37 additions & 0 deletions backend/src/docs/asciidoc/Team-API.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[[Team-API]]
= Team API

[[Team-새로운-소모임-조회]]
== Team 새로운 소모임 조회
operation::team-controller-test/get_team[snippets='http-request,query-parameters,http-response,response-fields']

== Team Category
|===
| Category | Description

| `SPORTS`
| 스포츠/운동

| `HABIT`
| 생활습관 개선

| `TEST`
| 시험/취업준비

| `STUDY`
| 스터디/공부

| `READING`
| 독서

| `ETC`
| 그외 자기계발
|===

[[Team-소모임-승인하기]]
== Team 소모임 승인하기
operation::team-controller-test/approve_team[snippets='http-request,query-parameters,http-response,response-fields']

[[Team-소모임-반려하기]]
== Team 소모임 반려하기
operation::team-controller-test/reject_team[snippets='http-request,query-parameters,http-response,response-fields']
14 changes: 14 additions & 0 deletions backend/src/docs/asciidoc/api.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
= Moing BO API Doc
:doctype: book
:icons: font
:source-highlighter: highlightjs
:toc: left
:toclevels: 1
:sectlinks:

include::Overview.adoc[]
include::Admin-API.adoc[]
include::Team-API.adoc[]



Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@SpringBootApplication
@EnableJpaAuditing
public class BackendApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.moing.bo.backend.domain.admin.application.dto.request;

import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class SignInRequest {
@NotBlank(message="id 을 입력해주세요.")
private String id;

@NotBlank(message = "password 을 입력해주세요.")
private String password;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.moing.bo.backend.domain.admin.application.dto.request;

import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class SignUpRequest {
@NotBlank(message="id 을 입력해주세요.")
private String id;

@NotBlank(message = "password 을 입력해주세요.")
private String password;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.moing.bo.backend.domain.admin.application.dto.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

public record CheckIdResponse(
Boolean isDuplicated
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.moing.bo.backend.domain.admin.application.dto.response;

import com.moing.bo.backend.global.response.TokenInfoResponse;

public record SignInResponse(
String accessToken,
String refreshToken
) {
public static SignInResponse from(TokenInfoResponse tokenInfoResponse) {
return new SignInResponse(
tokenInfoResponse.getAccessToken(),
tokenInfoResponse.getRefreshToken()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.moing.bo.backend.domain.admin.application.mapper;

import com.moing.bo.backend.domain.admin.application.dto.request.SignUpRequest;
import com.moing.bo.backend.domain.admin.domain.constant.Role;
import com.moing.bo.backend.domain.admin.domain.entity.Admin;
import com.moing.bo.backend.domain.team.domain.constant.ApprovalStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class AdminMapper {

public Admin toAdmin(SignUpRequest signUpRequest) {
return Admin.builder()
.loginId(signUpRequest.getId())
.password(signUpRequest.getPassword())
.role(Role.ADMIN)
.approvedStatus(ApprovalStatus.NO_CONFIRMATION)
.build();
}
}
Loading
Loading