Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
SeYeol00 committed Feb 9, 2023
1 parent 9cefec8 commit abf9e4f
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 5 deletions.
7 changes: 3 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ extra["springCloudVersion"] = "2021.0.5"

dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
// implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
// implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.google.cloud:spring-cloud-gcp-starter")
Expand All @@ -42,7 +41,7 @@ dependencies {
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")
// testImplementation("org.springframework.security:spring-security-test")
}

dependencyManagement {
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
mysql:
image: mysql:8-oracle
container_name: db_container1
ports:
- "3308:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: facegram
40 changes: 40 additions & 0 deletions src/main/kotlin/com/facegram/facegrambackend/domain/user/User.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.facegram.facegrambackend.domain.user

import lombok.NoArgsConstructor
import java.lang.IllegalArgumentException
import javax.persistence.*

@Entity
@NoArgsConstructor
class User constructor(

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Long? = null,

@Column
var username: String

) {
init{
if(username.isBlank()){
throw IllegalArgumentException("이름은 비어 있을 수 없습니다.")
}
}

fun updateUsername(name: String){
this.username = name
}

companion object{
fun newInstance(
username: String,
id: Long? = null
): User{
return User(id, username)
}
}



}
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

31 changes: 31 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3308/facegram?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
username: root
password: root
jpa:
hibernate:
ddl-auto: none
properties:
hibernate:
show_sql: true
format_sql: false
default_batch_fetch_size: 1000
#spring:
# datasource:
# url: 'jdbc:h2:mem:facegram'
# username: 'user'
# password: ''
# driver-class-name: org.h2.Driver
# jpa:
# hibernate:
# ddl-auto: create
# properties:
# hibernate:
# format_sql: true
# show_sql: true
# h2:
# console:
# enabled: true
# path: '/h2-console'

0 comments on commit abf9e4f

Please sign in to comment.