Skip to content

Commit

Permalink
Merge branch 'develop' into SCRUM-15-social-login
Browse files Browse the repository at this point in the history
  • Loading branch information
yeopyeop-82 authored Aug 19, 2024
2 parents 7de60fa + 62dabf0 commit 47832af
Show file tree
Hide file tree
Showing 75 changed files with 3,036 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Create Jira issue
on:
issues:
types:
- opened
jobs:
create-issue:
name: Create Jira issue
runs-on: ubuntu-latest
steps:
- name: Login
uses: atlassian/gajira-login@v3
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}

- name: Checkout main code
uses: actions/checkout@v4
with:
ref: main

- name: Issue Parser
uses: stefanbuck/github-issue-praser@v3
id: issue-parser
with:
template-path: .github/workflows/issue_form.yml

- name: Log Issue Parser
run: |
echo '${{ steps.issue-parser.outputs.jsonString }}'
- name: Convert markdown to Jira Syntax
uses: peter-evans/jira2md@v1
id: md2jira
with:
input-text: |
### Github Issue Link
- ${{ github.event.issue.html_url }}
${{ github.event.issue.body }}
mode: md2jira

- name: Create Issue
id: create
uses: atlassian/gajira-create@v3
with:
project: DIAR
issuetype: Subtask
summary: "${{ github.event.issue.title }}"
description: "${{ steps.md2jira.outputs.output-text }}"
fields: |
{
"parent": {
"key": "${{ steps.issue-parser.outputs.issueparser_parentKey }}"
}
}
- name: Log created issue
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"

- name: Checkout develop code
uses: actions/checkout@v4
with:
ref: develop

- name: Create branch with Ticket number
run: |
git checkout -b ${{ steps.create.outputs.issue }}
git push origin ${{ steps.create.outputs.issue }}
- name: Update issue title
uses: actions-cool/issues-helper@v3
with:
actions: "update-issue"
token: ${{ secrets.GITHUB_TOKEN }}
title: "${{ steps.create.outputs.issue }} ${{ github.event.issue.title }}"
53 changes: 53 additions & 0 deletions .github/workflows/issue-form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'SSDA Front 이슈 생성'
description: 'SSDA Front Repo에 이슈를 생성하며, 생성된 이슈는 Jira와 연동됩니다.'
labels: [order]
title: '이슈 이름을 작성해주세요'
on: push
body:
- type: input
id: parentKey
attributes:
label: '상위 작업 Ticket Number'
description: '상위 작업의 Ticket Number를 기입해주세요'
placeholder: 'DIAR-00'
validations:
required: true

- type: input
id: description
attributes:
label: '이슈 내용(Description)'
description: '이슈에 대해서 간략히 설명해주세요'
validations:
required: true

- type: textarea
id: details
attributes:
label: '상세 내용(Details)'
description: '이슈에 대해서 자세히 설명해주세요'
value: |
- About Details
validations:
required: true

- type: textarea
id: tasks
attributes:
label: '체크리스트(Tasks)'
description: '해당 이슈에 대해 필요한 작업목록을 작성해주세요'
value: |
- [ ] Task1
- [ ] Task2
validations:
required: true

- type: textarea
id: references
attributes:
label: '참조(References)'
description: '해당 이슈과 관련된 레퍼런스를 참조해주세요'
value: |
- Reference1
validations:
required: false
47 changes: 47 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,60 @@ dependencies {


implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'mysql:mysql-connector-java:8.0.33'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation group: 'org.qlrm', name: 'qlrm', version: '4.0.1'

// Mail
implementation 'org.springframework.boot:spring-boot-starter-mail'

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.4'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.0.4'

// Mysql
runtimeOnly('com.mysql:mysql-connector-j')

// Jwt
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'commons-codec:commons-codec:1.13'
implementation 'com.auth0:java-jwt:3.13.0'

// Redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

// Querydsl
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

}

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

tasks.withType(JavaCompile).configureEach {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(17))
})
}

// Ensure toolchains can be downloaded if not available locally
javaToolchains {
repositories {
mavenCentral()
maven {
url = uri("https://download.java.net/java/GA/jdk17/latest/binaries/")
}
}
}
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
rootProject.name = 'golagola'


2 changes: 2 additions & 0 deletions src/main/java/com/kakaoteck/golagola/GolagolaApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class GolagolaApplication {

public static void main(String[] args) {
SpringApplication.run(GolagolaApplication.class, args);
System.out.println("hello, world!");
System.out.println("GoodBye");
}
}

Expand Down
78 changes: 78 additions & 0 deletions src/main/java/com/kakaoteck/golagola/config/ApplicationConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.kakaoteck.golagola.config;

import com.kakaoteck.golagola.domain.buyer.entity.Buyer;
import com.kakaoteck.golagola.domain.buyer.repository.BuyerRepository;
import com.kakaoteck.golagola.domain.seller.entity.Seller;
import com.kakaoteck.golagola.domain.seller.repository.SellerRepository;
import com.kakaoteck.golagola.security.ApplicationAuditAware;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

import java.util.Collections;

@Configuration
@RequiredArgsConstructor
public class ApplicationConfig {

private final BuyerRepository buyerRepository;
private final SellerRepository sellerRepository;

@Bean
public UserDetailsService userDetailsService() {
return username -> {
// Try to find the user as a Buyer
Buyer buyer = buyerRepository.findByEmail(username).orElse(null);

if (buyer != null) {
System.out.println("Buyer found: " + username);
return buyer; // Buyer 객체를 반환
}

// Try to find the user as a Seller
Seller seller = sellerRepository.findByEmail(username).orElse(null);

if (seller != null) {
System.out.println("Seller loaded: " + seller.getEmail());
return seller; // Seller 객체를 반환
}

throw new UsernameNotFoundException("User not found with username: " + username);
};
}



@Bean
public AuthenticationProvider authenticationProvider() {
DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
authProvider.setUserDetailsService(userDetailsService());
authProvider.setPasswordEncoder(passwordEncoder());
return authProvider;
}

@Bean
public AuditorAware<Long> auditorAware() {
return new ApplicationAuditAware();
}

@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
return config.getAuthenticationManager();
}

@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
19 changes: 19 additions & 0 deletions src/main/java/com/kakaoteck/golagola/config/QueryDslConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.kakaoteck.golagola.config;

import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityManager;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@RequiredArgsConstructor
public class QueryDslConfig {

private final EntityManager em;

@Bean
public JPAQueryFactory jpaQueryFactory() {
return new JPAQueryFactory(em);
}
}
33 changes: 33 additions & 0 deletions src/main/java/com/kakaoteck/golagola/config/RedisConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.kakaoteck.golagola.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;

@Configuration
public class RedisConfig {

@Value("${spring.data.redis.host}")
private String redisHost;

@Value("${spring.data.redis.port}")
private int redisPort;

@Bean
public RedisConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisHost, redisPort);
}

@Bean
public RedisTemplate<String, Object> redisTemplate() {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(redisConnectionFactory());
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setValueSerializer(new StringRedisSerializer());
return redisTemplate;
}
}
Loading

0 comments on commit 47832af

Please sign in to comment.