Skip to content

Commit

Permalink
Merge pull request #6 from tukcomCD2024/backend/feature/social-login
Browse files Browse the repository at this point in the history
테이블명 단수에서 복수로 수정 + global error 추가
  • Loading branch information
yo0oni authored Jan 14, 2024
2 parents 8c42d8f + b8b21ca commit b5162c1
Show file tree
Hide file tree
Showing 38 changed files with 351 additions and 66 deletions.
6 changes: 6 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

//login
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation("com.auth0:java-jwt:3.16.0")
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'

}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.isp.backend.domain.image.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/images")
@RequiredArgsConstructor
public class ImageController {

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.isp.backend.domain.images.entity;
package com.isp.backend.domain.image.entity;

import com.isp.backend.domain.schedules.entity.MySchedules;
import com.isp.backend.domain.users.entity.Users;
import com.isp.backend.domain.schedules.entity.MySchedule;
import com.isp.backend.global.common.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
Expand All @@ -11,17 +10,17 @@
@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name="images")
public class Images extends BaseEntity {
@Table(name="image")
public class Image extends BaseEntity {

@Id
@Column(name="id", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id ;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "schedule_id", nullable = false)
private MySchedules mySchedules;
@JoinColumn(name = "my_schedule_id", nullable = false)
private MySchedule mySchedule;

@Column(name = "image_name")
private String imageName ;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.isp.backend.domain.image.repository;

import com.isp.backend.domain.image.entity.Image;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ImageRepository extends JpaRepository<Image, String> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.isp.backend.domain.image.service;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
public class ImageService {

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.isp.backend.domain.member.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/members")
@RequiredArgsConstructor
public class MemberController {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.isp.backend.domain.member.dto;

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

@NoArgsConstructor
@AllArgsConstructor
@Getter
public class GetGoogleUserDto {
private String uid;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.isp.backend.domain.users.entity;
package com.isp.backend.domain.member.entity;

import com.isp.backend.global.common.BaseEntity;
import jakarta.persistence.*;
Expand All @@ -9,29 +9,26 @@
@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name="users")
public class Users extends BaseEntity {
@Table(name="member")
public class Member extends BaseEntity {

@Id
@Column(name="id", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id ;

@Column(name = "uid", nullable = false)
private String uid ;

@Column(name = "name", nullable = false)
private String name ;

@Column(name = "birth")
private String birth ;

@Column(name = "email", nullable = false)
private String email ;

@Column(name = "phone_number")
private String phoneNumber ;

@Column(name = "password")
private String password ;

@Column(name = "login_type")
private String loginType ;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.isp.backend.domain.member.repository;

import com.isp.backend.domain.member.entity.Member;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface MemberRepository extends JpaRepository<Member, String> {

Optional<Member> findByUidAndActivatedIsTrue(String email);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.isp.backend.domain.member.service;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
public class MemberService {

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.isp.backend.domain.receipt.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/receipt")
@RequiredArgsConstructor
public class ReceiptController {

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.isp.backend.domain.places.entity;
package com.isp.backend.domain.receipt.entity;

import com.isp.backend.domain.schedules.entity.MySchedules;
import com.isp.backend.domain.schedules.entity.MySchedule;
import com.isp.backend.global.common.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
Expand All @@ -10,8 +10,8 @@
@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name="receipts")
public class Receipts extends BaseEntity {
@Table(name="receipt")
public class Receipt extends BaseEntity {

@Id
@Column(name="id", unique = true, nullable = false)
Expand All @@ -20,7 +20,7 @@ public class Receipts extends BaseEntity {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "schedule_id", nullable = false)
private MySchedules mySchedules;
private MySchedule mySchedule;

@Column(name = "title")
private String title ;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.isp.backend.domain.receipt.service;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
public class ReceiptService {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
package com.isp.backend.domain.schedules.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/schedules")
@RequiredArgsConstructor
public class ScheduleController {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.isp.backend.domain.schedules.entity;

import com.isp.backend.domain.places.entity.TravelPlaces;
import com.isp.backend.domain.users.entity.Users;
import com.isp.backend.domain.member.entity.Member;
import com.isp.backend.domain.travelPlace.entity.TravelPlace;
import com.isp.backend.global.common.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
Expand All @@ -14,8 +14,8 @@
@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name="my_schedules")
public class MySchedules extends BaseEntity {
@Table(name="my_schedule")
public class MySchedule extends BaseEntity {

@Id
@Column(name="id", unique = true, nullable = false)
Expand All @@ -26,12 +26,12 @@ public class MySchedules extends BaseEntity {
private String scheduleName ;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private Users users;
@JoinColumn(name = "member_id", nullable = false)
private Member member;

@Builder.Default
@OneToMany(mappedBy = "mySchedules", cascade = CascadeType.ALL, orphanRemoval = true)
private List<TravelPlaces> travelPlaces = new ArrayList<>();
@OneToMany(mappedBy = "mySchedule", cascade = CascadeType.ALL, orphanRemoval = true)
private List<TravelPlace> travelPlaces = new ArrayList<>();

// FK 연결 필요
@Column(name = "booking_id")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.isp.backend.domain.schedules.entity;

import com.isp.backend.domain.users.entity.Users;
import com.isp.backend.domain.member.entity.Member;
import com.isp.backend.global.common.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
Expand All @@ -10,20 +10,20 @@
@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name="shared_schedules")
public class SharedSchedules extends BaseEntity {
@Table(name="shared_schedule")
public class SharedSchedule extends BaseEntity {

@Id
@Column(name="id", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id ;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "schedule_id", nullable = false)
private MySchedules mySchedules;
@JoinColumn(name = "my_schedule_id", nullable = false)
private MySchedule mySchedule;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private Users users;
private Member member;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.isp.backend.domain.schedules.repository;

import com.isp.backend.domain.schedules.entity.MySchedule;
import org.springframework.data.jpa.repository.JpaRepository;

public interface MyScheduleRepository extends JpaRepository<MySchedule, String> {

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.isp.backend.domain.schedules.repository;

import com.isp.backend.domain.schedules.entity.SharedSchedule;
import org.springframework.data.jpa.repository.JpaRepository;

public interface SharedScheduleRepository extends JpaRepository<SharedSchedule, String> {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package com.isp.backend.domain.schedules.service;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
public class ScheduleService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.isp.backend.domain.travelPlace.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/places")
@RequiredArgsConstructor
public class TravelPlaceController {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.isp.backend.domain.places.entity;
package com.isp.backend.domain.travelPlace.entity;

import com.isp.backend.domain.schedules.entity.MySchedules;
import com.isp.backend.domain.schedules.entity.MySchedule;
import com.isp.backend.global.common.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
Expand All @@ -10,8 +10,8 @@
@Entity
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name="travel_places")
public class TravelPlaces extends BaseEntity {
@Table(name="travel_place")
public class TravelPlace extends BaseEntity {

@Id
@Column(name="id", unique = true, nullable = false)
Expand All @@ -30,10 +30,11 @@ public class TravelPlaces extends BaseEntity {
@Column(name = "longitude") // 경도
private double longitude ;

@Column(name = "latitude") // 위도
@Column(name = "latitude") // 위도
private double latitude ;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "schedule_id", nullable = false)
private MySchedules mySchedules;
@JoinColumn(name = "my_schedule_id", nullable = false)
private MySchedule mySchedule;

}
Loading

0 comments on commit b5162c1

Please sign in to comment.