Skip to content

Commit

Permalink
Merge branch 'backend' into feat/Folder-API-생성-#29
Browse files Browse the repository at this point in the history
  • Loading branch information
kryptonite43 authored Mar 26, 2023
2 parents b95d06d + 6059c3b commit 2a8d9f2
Show file tree
Hide file tree
Showing 23 changed files with 558 additions and 171 deletions.
18 changes: 7 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ repositories {
mavenCentral()
jcenter()
}
//
//ext {
// set('snippetsDir', file("build/generated-snippets"))
//}


dependencies {
implementation 'mysql:mysql-connector-java'
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
runtimeOnly 'com.h2database:h2'
compileOnly 'org.projectlombok:lombok'
// implementation 'org.springframework.session:spring-session-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'io.jsonwebtoken:jjwt-api:0.11.1'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.1', 'io.jsonwebtoken:jjwt-jackson:0.11.1'
implementation 'org.springframework.cloud:spring-cloud-gcp-starter-storage:1.2.8.RELEASE'
// implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
// implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
// implementation 'org.springframework.cloud:spring-cloud-gcp-starter-storage:1.2.8.RELEASE'

implementation group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starter', version: '1.2.5.RELEASE'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-gcp-storage', version: '1.2.5.RELEASE'
annotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
// implementation 'mysql:mysql-connector-java'
}

Expand All @@ -44,8 +44,4 @@ tasks.named('test') {
// outputs.dir snippetsDir
useJUnitPlatform()
}
//
//tasks.named('asciidoctor') {
// inputs.dir snippetsDir
// dependsOn test
//}

51 changes: 51 additions & 0 deletions src/main/java/com/SollutionChallenge/HighLight/File/File.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.SollutionChallenge.HighLight.File;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.SollutionChallenge.HighLight.User.Entity.User;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "file")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class File {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "file_id", unique = true, nullable = false)
@Getter
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private User userId;

@Column(nullable = false)
private String fileName;

@Column(nullable = false)
private String fileUrl;

private static File createFile(Long id, User userId, String fileName, String fileUrl) {
File file= new File();
file.id=id;
file.userId=userId;
file.fileName=fileName;
file.fileUrl=fileUrl;
return new File();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import javax.persistence.ManyToOne;
import javax.persistence.Table;


import com.SollutionChallenge.HighLight.User.User;


import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down Expand Up @@ -43,6 +45,7 @@ public static Folder createFolder( User userId, String name){
folder.name=name;

return folder;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@NoArgsConstructor
@AllArgsConstructor
public class FolderRequestDto {

private Long userId;
private String folderName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ public FolderResponseDto viewOneFolder(Long folder_id) {
return FolderResponseDto.from(folder_id,folder.get().getName());

}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.SollutionChallenge.HighLight;

import com.SollutionChallenge.HighLight.controller.GCSController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -10,7 +9,7 @@

// @EnableJpaAuditing
@SpringBootApplication
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.SollutionChallenge.HighLight","com.SollutionChallenge.HighLight.User"})
public class HighLightApplication {
public static void main(String[] args) {
SpringApplication.run(HighLightApplication.class, args);
Expand Down
61 changes: 61 additions & 0 deletions src/main/java/com/SollutionChallenge/HighLight/Image/Image.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.SollutionChallenge.HighLight.Image;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.SollutionChallenge.HighLight.File.File;
import com.SollutionChallenge.HighLight.Page.Page;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "image")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class Image {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "image_id", unique = true, nullable = false)
@Getter
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "file_id", nullable = false)
private File fileId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "page_id", nullable = false)
private Page pageId;

@Column(nullable = false)
private String imageDescription;

@Column(nullable = false)
private String imageUrl;

@Column(nullable = false)
private String voiceUrl;

private static Image createImage(Long id, File fileId, Page pageId, String imageDescription, String imageUrl,
String voiceUrl) {
Image image = new Image();
image.id = id;
image.fileId = fileId;
image.pageId = pageId;
image.imageDescription = imageDescription;
image.imageUrl = imageUrl;
image.voiceUrl = voiceUrl;
return new Image();
}
}
42 changes: 42 additions & 0 deletions src/main/java/com/SollutionChallenge/HighLight/Page/Page.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.SollutionChallenge.HighLight.Page;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.SollutionChallenge.HighLight.File.File;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "page")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class Page {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "page_id", unique = true, nullable = false)
@Getter
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "file_id", nullable = false)
private File fileId;

private static Page createPage(Long id, File fileId) {
Page page = new Page();
page.id=id;
page.fileId=fileId;
return new Page();
}
}
57 changes: 57 additions & 0 deletions src/main/java/com/SollutionChallenge/HighLight/Text/Text.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.SollutionChallenge.HighLight.Text;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.SollutionChallenge.HighLight.File.File;
import com.SollutionChallenge.HighLight.Page.Page;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "text")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class Text {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "text_id", unique = true, nullable = false)
@Getter
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "file_id", nullable = false)
private File fileId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "page_id", nullable = false)
private Page pageId;

@Column(nullable = false, columnDefinition = "TEXT")
private String content;

@Column(nullable = false)
private String voiceUrl;

private static Text createText(Long id, File fileId, Page pageId, String content, String voiceUrl) {
Text text = new Text();
text.id=id;
text.fileId=fileId;
text.pageId=pageId;
text.content=content;

return new Text();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.SollutionChallenge.HighLight.User.Entity;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum Role {

GUEST("ROLE_GUEST", "손님"),
USER("ROLE_USER", "일반 사용자");

private final String key;
private final String title;

}
Loading

0 comments on commit 2a8d9f2

Please sign in to comment.