Skip to content

Commit

Permalink
Merge pull request #122 from depromeet/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
leeseojune53 authored Dec 13, 2022
2 parents b69c090 + f3210dc commit 4d21980
Show file tree
Hide file tree
Showing 173 changed files with 5,636 additions and 13 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Knock Knock Build
on:
push:
tags:
- v*.*.*

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 11 ]
outputs:
version: ${{ steps.get_version.outputs.BRANCH_NAME }}

steps:
- name: Check Out The Repository
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Gradle Build
uses: gradle/gradle-build-action@v2
with:
arguments: |
build -x test
--no-daemon
- name: Login to ECR
id: ecr
uses: elgohr/ecr-login-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY }}
secret_access_key: ${{ secrets.AWS_SECRET_KEY }}
region: ${{ secrets.AWS_REGION }}

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: knock-knock
username: ${{ steps.ecr.outputs.username }}
password: ${{ steps.ecr.outputs.password }}
registry: ${{ steps.ecr.outputs.registry }}
tags: ${{ steps.get_version.outputs.VERSION }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ out/

### VS Code ###
.vscode/

.env
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM openjdk:11.0.6-jre

EXPOSE 8080

COPY ./build/libs/*.jar app.jar

ENTRYPOINT ["java","-jar","/app.jar"]
33 changes: 31 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ configurations {
}
}

compileJava {
options.compilerArgs << '-Amapstruct.defaultComponentModel=spring'
}


repositories {
mavenCentral()
}
Expand All @@ -28,6 +33,12 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'mysql:mysql-connector-java'

implementation 'com.querydsl:querydsl-jpa'
annotationProcessor(
"javax.persistence:javax.persistence-api",
"javax.annotation:javax.annotation-api",
"com.querydsl:querydsl-apt:5.0.0:jpa")

implementation 'org.springframework.boot:spring-boot-starter-validation'

implementation 'org.springframework.boot:spring-boot-starter-security'
Expand All @@ -36,13 +47,31 @@ dependencies {
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'

implementation 'org.springframework.cloud:spring-cloud-starter-openfeign:3.1.4'

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'


implementation 'org.springdoc:springdoc-openapi-ui:1.6.12'
implementation 'io.github.openfeign:feign-httpclient:12.0'

implementation 'org.mapstruct:mapstruct:1.4.2.Final'
implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'

//순서 중요
annotationProcessor "org.mapstruct:mapstruct-processor:1.4.1.Final"
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
annotationProcessor 'org.projectlombok:lombok'


}

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

jar {
enabled = false
}
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3.7'
services:
redis:
image: 'redis:alpine'
ports:
- '6379:6379'
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package io.github.depromeet.knockknockbackend.domain.group.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
* QGroup is a Querydsl query type for Group
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QGroup extends EntityPathBase<Group> {

private static final long serialVersionUID = -686918346L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QGroup group = new QGroup("group1");

public final io.github.depromeet.knockknockbackend.global.database.QBaseTimeEntity _super = new io.github.depromeet.knockknockbackend.global.database.QBaseTimeEntity(this);

public final StringPath backgroundImagePath = createString("backgroundImagePath");

public final QCategory category;

//inherited
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate;

public final StringPath description = createString("description");

public final EnumPath<GroupType> groupType = createEnum("groupType", GroupType.class);

public final QGroupUsers groupUsers;

public final NumberPath<Long> id = createNumber("id", Long.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> modifiedDate = _super.modifiedDate;

public final ListPath<io.github.depromeet.knockknockbackend.domain.notification.domain.Notification, io.github.depromeet.knockknockbackend.domain.notification.domain.QNotification> notifications = this.<io.github.depromeet.knockknockbackend.domain.notification.domain.Notification, io.github.depromeet.knockknockbackend.domain.notification.domain.QNotification>createList("notifications", io.github.depromeet.knockknockbackend.domain.notification.domain.Notification.class, io.github.depromeet.knockknockbackend.domain.notification.domain.QNotification.class, PathInits.DIRECT2);

public final BooleanPath publicAccess = createBoolean("publicAccess");

public final StringPath thumbnailPath = createString("thumbnailPath");

public final StringPath title = createString("title");

public QGroup(String variable) {
this(Group.class, forVariable(variable), INITS);
}

public QGroup(Path<? extends Group> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QGroup(PathMetadata metadata) {
this(metadata, PathInits.getFor(metadata, INITS));
}

public QGroup(PathMetadata metadata, PathInits inits) {
this(Group.class, metadata, inits);
}

public QGroup(Class<? extends Group> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.category = inits.isInitialized("category") ? new QCategory(forProperty("category")) : null;
this.groupUsers = inits.isInitialized("groupUsers") ? new QGroupUsers(forProperty("groupUsers")) : null;
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.github.depromeet.knockknockbackend.domain.group.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
* QGroupUser is a Querydsl query type for GroupUser
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QGroupUser extends EntityPathBase<GroupUser> {

private static final long serialVersionUID = 334318113L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QGroupUser groupUser = new QGroupUser("groupUser");

public final io.github.depromeet.knockknockbackend.global.database.QBaseTimeEntity _super = new io.github.depromeet.knockknockbackend.global.database.QBaseTimeEntity(this);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate;

public final QGroup group;

public final NumberPath<Long> id = createNumber("id", Long.class);

public final BooleanPath isHost = createBoolean("isHost");

//inherited
public final DateTimePath<java.time.LocalDateTime> modifiedDate = _super.modifiedDate;

public final io.github.depromeet.knockknockbackend.domain.user.domain.QUser user;

public QGroupUser(String variable) {
this(GroupUser.class, forVariable(variable), INITS);
}

public QGroupUser(Path<? extends GroupUser> path) {
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QGroupUser(PathMetadata metadata) {
this(metadata, PathInits.getFor(metadata, INITS));
}

public QGroupUser(PathMetadata metadata, PathInits inits) {
this(GroupUser.class, metadata, inits);
}

public QGroupUser(Class<? extends GroupUser> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.group = inits.isInitialized("group") ? new QGroup(forProperty("group"), inits.get("group")) : null;
this.user = inits.isInitialized("user") ? new io.github.depromeet.knockknockbackend.domain.user.domain.QUser(forProperty("user")) : null;
}

}

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

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


@SpringBootApplication
public class KnockKnockBackendApplication {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.github.depromeet.knockknockbackend.domain.credential.domain;

import lombok.Builder;
import lombok.Getter;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.TimeToLive;
import org.springframework.data.redis.core.index.Indexed;

@RedisHash(value = "refreshToken")
@Getter
public class RefreshTokenRedisEntity {

@Id
private String id;

@Indexed
private String refreshToken;

@TimeToLive // TTL
private Long ttl;

@Builder
public RefreshTokenRedisEntity(String id, String refreshToken, Long ttl) {
this.id = id;
this.refreshToken = refreshToken;
this.ttl = ttl;
}

public void updateTTL(Long ttl) {
this.ttl += ttl;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.depromeet.knockknockbackend.domain.credential.domain.repository;

import io.github.depromeet.knockknockbackend.domain.credential.domain.RefreshTokenRedisEntity;
import java.util.Optional;
import org.springframework.data.repository.CrudRepository;

public interface RefreshTokenRedisEntityRepository extends CrudRepository<RefreshTokenRedisEntity, String> {
Optional<RefreshTokenRedisEntity> findByRefreshToken(String refreshToken);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.github.depromeet.knockknockbackend.domain.credential.exception;

import io.github.depromeet.knockknockbackend.global.error.exception.ErrorCode;
import io.github.depromeet.knockknockbackend.global.error.exception.KnockException;

public class AlreadySignUpUserException extends KnockException {

public static final KnockException EXCEPTION = new AlreadySignUpUserException();

private AlreadySignUpUserException() {
super(ErrorCode.ALREADY_SIGNUP_USER);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.github.depromeet.knockknockbackend.domain.credential.exception;


import io.github.depromeet.knockknockbackend.global.error.exception.ErrorCode;
import io.github.depromeet.knockknockbackend.global.error.exception.KnockException;

// 잘못되거나 appid가 일치하지 않은 인증 토큰일경우 에러
public class OauthTokenInvalidException extends KnockException {
public static final KnockException EXCEPTION = new OauthTokenInvalidException();
private OauthTokenInvalidException() {
super(ErrorCode.EXPIRED_TOKEN);
}

}
Loading

0 comments on commit 4d21980

Please sign in to comment.