Skip to content

Commit

Permalink
Merge pull request #1 from jminkkk/jminkkk
Browse files Browse the repository at this point in the history
버전 맞추기
  • Loading branch information
jminkkk authored Nov 21, 2023
2 parents 963c8d1 + 23babdb commit f641850
Show file tree
Hide file tree
Showing 120 changed files with 5,905 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# yml
application-local.yml

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
Expand Down
3 changes: 3 additions & 0 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.timcooki.jnuwiki.JnuwikiApplication

32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# JNU-wiki
2023년 1학기 에코노베이션 Tim Cooki 팀의 < JNU-wiki > 프로젝트
# 🍪 팀쿠키
|쿠키(BE)|몰리(BE)|가여니(FE)|또리(FE)|루트(AOS)|
|------|---|---|---|--|
|<img width="200" alt="스크린샷 2023-09-27 오전 11 44 41" src="https://github.com/JNU-econovation/gikhub/assets/102847513/47f9eb46-b7e4-4e25-8f7d-75585ddad749">|<img src = https://github.com/JNU-econovation/gikhub/assets/102847513/22c19f61-bd41-460e-bc66-8dad6c774a87 width = 200>|<img src = https://github.com/JNU-econovation/gikhub/assets/102847513/182d0fbc-dfff-40eb-8032-4a9f88d14b6c width = 200>|<img width="200" alt="스크린샷 2023-09-27 오전 11 44 25" src="https://github.com/JNU-econovation/gikhub/assets/102847513/2433c9ce-22cf-433d-b96c-8189d46dfb23">|<img src = https://github.com/JNU-econovation/gikhub/assets/102847513/d6109dbb-446a-4bb2-b2ce-947c8521bbba width = 200>|

## 프로젝트 기간

Version 1 : 2023.03.06 ~ 진행 중

## 배포 주소

진행중...

## 프로젝트 소개

적은 학교정보에 지친 용봉이들을 위한 경험 기반의 위키 서비스
+ 지도를 이용한 어디서든 이용 가능한 ✨전대위키

<div align=center>
<br>
<img src="https://img.shields.io/badge/java-007396?style=for-the-badge&logo=java&logoColor=white">
<img src="https://img.shields.io/badge/mysql-4479A1?style=for-the-badge&logo=mysql&logoColor=white">
<img src="https://img.shields.io/badge/spring-6DB33F?style=for-the-badge&logo=spring&logoColor=white">
<img src="https://img.shields.io/badge/apache tomcat-F8DC75?style=for-the-badge&logo=apachetomcat&logoColor=white">
<br>
<br>
<img src="https://img.shields.io/badge/github-181717?style=for-the-badge&logo=github&logoColor=white">
<img src="https://img.shields.io/badge/git-F05032?style=for-the-badge&logo=git&logoColor=white">
<br>
</div>
35 changes: 34 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,47 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
// mapstruct
implementation 'org.mapstruct:mapstruct:1.5.3.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'

// test -> LocalDateTime 오류
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.0")

// springdoc(swagger)
implementation 'org.springdoc:springdoc-openapi-ui:1.6.8'
}

// mapstruct 기본 Component Model 변경
compileJava {
options.compilerArgs += ['-Amapstruct.defaultComponentModel=spring']
}
compileTestJava {
options.compilerArgs += ['-Amapstruct.defaultComponentModel=spring']
}
//test {
// useJUnitPlatform()
// jvmArgs(['--enable-preview', '-Amapstruct.defaultComponentModel=spring'])
//}

jar {
manifest {
attributes 'Main-Class': 'com.timcooki.jnuwiki.JnuwikiApplication'
}
}

// JPA 메타모델 생성 설정
compileJava.options.annotationProcessorPath = configurations.compileClasspath

// TODO: gradle 알아보기
tasks.named('test') {
useJUnitPlatform()
}
}
Binary file added erd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### PR 타입(하나 이상의 PR 타입을 선택해주세요)

- [ ] 기능 추가
- [ ] 기능 수정
- [ ] 기능 삭제
- [ ] 리팩토링
- [ ] 버그 수정
- [ ] 의존성, 환경 변수, 빌드 관련 코드 업데이트

### 작업 사항

- 작업 사항

### 관련 이슈

closes #
2 changes: 2 additions & 0 deletions src/main/java/com/timcooki/jnuwiki/JnuwikiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

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

@EnableJpaAuditing
@SpringBootApplication
public class JnuwikiApplication {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.timcooki.jnuwiki.configuration;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI openAPI(){
return new OpenAPI()
.components(new Components())
.info(apiInfo());
}

private Info apiInfo(){
return new Info()
.title("전대위키")
.description("전대위키 API문서")
.version("0.0.1");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.timcooki.jnuwiki.domain.docs.DTO.request;


import lombok.Builder;

public record ContentEditReqDTO(
String docsContent
) {
@Builder
public ContentEditReqDTO {

}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.timcooki.jnuwiki.domain.docs.DTO.request;

import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation;
import lombok.Builder;

public record FindAllReqDTO(
Double rightLat,
Double rightLng,
Double leftLat,
Double leftLng
) {
@Builder
public FindAllReqDTO{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.timcooki.jnuwiki.domain.docs.DTO.response;

import lombok.Builder;

import java.time.LocalDateTime;

public record ContentEditResDTO(
Long id,
String docsContent,
String docsModifiedAt
) {
@Builder
public ContentEditResDTO {

}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.timcooki.jnuwiki.domain.docs.DTO.response;

import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation;
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsCategory;
import lombok.Builder;
import java.time.LocalDateTime;

public record InfoEditResDTO(
Long docsId,
String docsName,
String docsCategory,
DocsLocation docsLocation,
String docsContent,
String docsModifiedAt
) {
@Builder
public InfoEditResDTO {

}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.timcooki.jnuwiki.domain.docs.DTO.response;

import lombok.Builder;

import java.util.List;

public record ListReadResDTO(
List<OneOfListReadResDTO> docsList,
int totalPages
) {
@Builder
public ListReadResDTO {
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.timcooki.jnuwiki.domain.docs.DTO.response;

import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation;
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsCategory;
import lombok.Builder;

import java.time.LocalDateTime;

public record NewApproveResDTO(
Long id,
String docsName,
String docsCategory,
DocsLocation docsLocation,
String docsCreatedAt
){
@Builder
public NewApproveResDTO {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.timcooki.jnuwiki.domain.docs.DTO.response;

import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation;
import lombok.Builder;

public record OneOfListReadResDTO(
Long docsId,
String docsName,
String docsCategory,
DocsLocation docsLocation,
boolean scrap

) {
@Builder
public OneOfListReadResDTO {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.timcooki.jnuwiki.domain.docs.DTO.response;

import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation;
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsCategory;
import com.timcooki.jnuwiki.domain.member.entity.Member;
import lombok.Builder;

import java.time.LocalDateTime;

public record ReadResDTO(
Long id,
String docsName,
String docsCategory,
DocsLocation docsLocation,
String docsContent,
String docsCreatedBy,
String docsCreatedAt,
boolean scrap
) {
@Builder
public ReadResDTO {

}
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.timcooki.jnuwiki.domain.docs.DTO.response;

import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation;
import com.timcooki.jnuwiki.domain.docsRequest.entity.DocsCategory;
import com.timcooki.jnuwiki.domain.member.entity.Member;
import lombok.Builder;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.time.LocalDateTime;

public record SearchReadResDTO(
Long docsId,
String docsName,
DocsLocation docsLocation,
String docsContent,
String createdBy,
String createdAt,
String docsCategory
) {
@Builder
public SearchReadResDTO{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.timcooki.jnuwiki.domain.docs.controller;

import com.timcooki.jnuwiki.domain.docs.DTO.request.ContentEditReqDTO;
import com.timcooki.jnuwiki.domain.docs.DTO.request.FindAllReqDTO;
import com.timcooki.jnuwiki.domain.docs.entity.DocsLocation;
import com.timcooki.jnuwiki.domain.docs.service.DocsReadService;
import com.timcooki.jnuwiki.domain.docs.service.DocsWriteService;
import com.timcooki.jnuwiki.util.ApiUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.*;


@RestController
@RequiredArgsConstructor
@Slf4j
public class DocsController {
private final DocsReadService docsReadService;
private final DocsWriteService docsWriteService;

// 모든 문서 조회 - 최근 수정된 순으로
// 좌표 사이로
@GetMapping("/docs")
public ResponseEntity<?> docsFindAll(@PageableDefault(size = 50, sort = "modifiedAt", direction = Sort.Direction.DESC) Pageable pageable
, FindAllReqDTO findAllReqDTO) {

return ResponseEntity.ok().body(ApiUtils.success(docsReadService.getDocsList(pageable, findAllReqDTO)));
}

// 문서 수정
@PutMapping("/docs/{docs_id}")
public ResponseEntity<?> modifyDocs(@PathVariable Long docs_id, @RequestBody ContentEditReqDTO contentEditReqDTO) {
return ResponseEntity.ok().body(ApiUtils.success(docsWriteService.updateDocs(docs_id, contentEditReqDTO)));
}

@GetMapping("/docs/{docs_id}")
public ResponseEntity<?> docsFindOne(@PathVariable Long docs_id) {
return ResponseEntity.ok().body(ApiUtils.success(docsReadService.getOneDocs(docs_id)));
}

@GetMapping("/docs/search")
public ResponseEntity<?> docsSearch(@RequestParam(value = "search") String search) {

return ResponseEntity.ok(ApiUtils.success(docsReadService.searchLike(search)));
}
}
Loading

0 comments on commit f641850

Please sign in to comment.