Skip to content

Commit

Permalink
Merge pull request #158 from depromeet/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
leeseojune53 authored Dec 17, 2022
2 parents 4d21980 + e74b81a commit c0221be
Show file tree
Hide file tree
Showing 249 changed files with 3,581 additions and 2,015 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Knock Knock Build
on:
pull_request:
branch: 'dev'

jobs:
java-continuous-integration:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: SetUp JDK 11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: 'adopt'

- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Run build
run: ./gradlew build -x test
26 changes: 15 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'org.springframework.boot' version '2.7.4'
id 'io.spring.dependency-management' version '1.0.14.RELEASE'
id 'java'
id 'com.diffplug.spotless' version '6.11.0'
}

group = 'io.github.depromeet'
Expand All @@ -14,11 +15,6 @@ configurations {
}
}

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


repositories {
mavenCentral()
}
Expand All @@ -28,6 +24,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web-services'

implementation 'com.google.firebase:firebase-admin:9.1.0'
implementation 'com.amazonaws:aws-java-sdk-s3control:1.12.364'

implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
Expand Down Expand Up @@ -57,15 +54,11 @@ dependencies {
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'


implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation "io.micrometer:micrometer-registry-prometheus"
}

tasks.named('test') {
Expand All @@ -74,4 +67,15 @@ tasks.named('test') {

jar {
enabled = false
}

spotless {
java {
target("**/*.java")
googleJavaFormat().aosp()
importOrder()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

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.PathMetadata;
import com.querydsl.core.types.dsl.*;
import com.querydsl.core.types.dsl.PathInits;
import javax.annotation.processing.Generated;


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

Expand All @@ -22,13 +18,14 @@ public class QGroup extends EntityPathBase<Group> {

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 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
// inherited
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate;

public final StringPath description = createString("description");
Expand All @@ -39,10 +36,25 @@ public class QGroup extends EntityPathBase<Group> {

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

//inherited
// 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 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");

Expand All @@ -68,9 +80,11 @@ public QGroup(PathMetadata metadata, PathInits 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;
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
Expand Up @@ -2,17 +2,13 @@

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.PathMetadata;
import com.querydsl.core.types.dsl.*;
import com.querydsl.core.types.dsl.PathInits;
import javax.annotation.processing.Generated;


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

Expand All @@ -22,9 +18,10 @@ public class QGroupUser extends EntityPathBase<GroupUser> {

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);
public final io.github.depromeet.knockknockbackend.global.database.QBaseTimeEntity _super =
new io.github.depromeet.knockknockbackend.global.database.QBaseTimeEntity(this);

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

public final QGroup group;
Expand All @@ -33,7 +30,7 @@ public class QGroupUser extends EntityPathBase<GroupUser> {

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

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

public final io.github.depromeet.knockknockbackend.domain.user.domain.QUser user;
Expand All @@ -56,9 +53,14 @@ public QGroupUser(PathMetadata metadata, PathInits 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;
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
@@ -1,15 +1,13 @@
package io.github.depromeet.knockknockbackend;


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


@SpringBootApplication
public class KnockKnockBackendApplication {

public static void main(String[] args) {
SpringApplication.run(KnockKnockBackendApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package io.github.depromeet.knockknockbackend.domain.group.domain;
package io.github.depromeet.knockknockbackend.domain.admission.domain;


import io.github.depromeet.knockknockbackend.domain.admission.event.NewAdmissionEvent;
import io.github.depromeet.knockknockbackend.domain.group.domain.Group;
import io.github.depromeet.knockknockbackend.domain.user.domain.User;
import io.github.depromeet.knockknockbackend.global.database.BaseTimeEntity;
import io.github.depromeet.knockknockbackend.global.event.Events;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
Expand All @@ -13,6 +16,7 @@
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PostPersist;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
Expand All @@ -39,27 +43,41 @@ public class Admission extends BaseTimeEntity {
@Enumerated(value = EnumType.STRING)
private AdmissionState admissionState;


@Builder
public Admission(User requester, Group group,
AdmissionState admissionState) {
public Admission(User requester, Group group, AdmissionState admissionState) {
this.requester = requester;
this.group = group;
this.admissionState = admissionState;
}

public static Admission createAdmission(User requester, Group group){
public static Admission createAdmission(User requester, Group group) {
return Admission.builder()
.admissionState(AdmissionState.PENDING)
.requester(requester)
.group(group)
.build();
.admissionState(AdmissionState.PENDING)
.requester(requester)
.group(group)
.build();
}

@PostPersist
private void requestAdmission() {
Group group = getGroup();

NewAdmissionEvent newAdmissionEvent =
NewAdmissionEvent.builder()
.requesterId(requester.getId())
.groupId(group.getId())
.admissionId(getId())
.hostId(group.getHost().getId())
.build();

Events.raise(newAdmissionEvent);
}

public void refuseAdmission(){
public void refuseAdmission() {
admissionState = AdmissionState.REFUSE;
}
public void acceptAdmission(){

public void acceptAdmission() {
admissionState = AdmissionState.ACCEPT;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.github.depromeet.knockknockbackend.domain.group.domain;
package io.github.depromeet.knockknockbackend.domain.admission.domain;


import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.depromeet.knockknockbackend.domain.admission.domain.repository;


import io.github.depromeet.knockknockbackend.domain.admission.domain.Admission;
import io.github.depromeet.knockknockbackend.domain.admission.domain.AdmissionState;
import io.github.depromeet.knockknockbackend.domain.group.domain.Group;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;

public interface AdmissionRepository extends JpaRepository<Admission, Long> {

List<Admission> findByGroupAndAdmissionState(Group group, AdmissionState pending);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.github.depromeet.knockknockbackend.domain.admission.event;


import io.github.depromeet.knockknockbackend.global.event.DomainEvent;
import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
public class NewAdmissionEvent implements DomainEvent {
private final Long requesterId;
private final Long admissionId;
private final Long hostId;
private final Long groupId;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.github.depromeet.knockknockbackend.domain.group.exception;
package io.github.depromeet.knockknockbackend.domain.admission.exception;


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

0 comments on commit c0221be

Please sign in to comment.