Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7ace693
[FEAT] createMedication api에서 DosingTime을 리스트로 받도록 구현
yooputer Feb 13, 2023
686e76f
[FIX] modifyMedication api 수정
yooputer Feb 13, 2023
06d44ce
Merge pull request #15 from GDSC-sswu-A/medication
yooputer Feb 13, 2023
5fb59cf
[FIX] Location 엔티티, DTO, setLocationInfo api 수정
yooputer Feb 14, 2023
50a0f56
[FIX] getLocationInfo api 수정
yooputer Feb 14, 2023
d13b55e
Merge pull request #16 from GDSC-sswu-A/user-family
yooputer Feb 14, 2023
3ff22db
[FEAT] getHomeInfo api 개발(미완성)
yooputer Feb 20, 2023
5a7e6a6
[FEAT] Schedule 엔티티, dto, 레파지토리 생성
yooputer Feb 20, 2023
fb8a9f5
[FEAT] createSchedule, getScheduleList, getTodayScheduleList, deleteS…
yooputer Feb 20, 2023
3dd15d7
Merge pull request #17 from GDSC-sswu-A/schedule
yooputer Feb 20, 2023
b4254b1
[FEAT] 마지막 api호출시간 저장 구현
yooputer Feb 25, 2023
6980b13
[FEAT] getParentsLastApiCallTime api 구현
yooputer Feb 25, 2023
2dda1d8
Merge pull request #18 from GDSC-sswu-A/etc
yooputer Feb 25, 2023
f4a2553
[FEAT] Photo 엔티티, 레파지토리, dto, 서비스, 컨트롤러 생성
yooputer Feb 25, 2023
31d15c9
[FEAT] uploadPhoto api 구현
yooputer Feb 25, 2023
5503e5b
Merge pull request #19 from GDSC-sswu-A/gallery
yooputer Feb 25, 2023
454a23c
Merge commit '5503e5bbd03424a9c440dc13a93b90eae622eb8e' into user-family
yooputer Feb 25, 2023
efe060c
[FIX] photo 엔티티 수정
yooputer Feb 25, 2023
f90988f
Merge pull request #20 from GDSC-sswu-A/gallery
yooputer Feb 25, 2023
f16e2a3
Merge commit 'f90988f7af36d1d3064a1238e30221096c1e2930' into user-family
yooputer Feb 25, 2023
7e4a222
[FEAT] getHomeInfo api 구현
yooputer Feb 25, 2023
3c8fde2
Merge pull request #21 from GDSC-sswu-A/user-family
yooputer Feb 25, 2023
27539c2
[FEAT]Modify schedule api 구현
0gonge Mar 2, 2023
8171519
[FiX] delete photo api 구현
0gonge Mar 12, 2023
b1a139c
[FEAT] ModifyPhoto api 구현
0gonge Mar 13, 2023
274a60b
[FEAT] get photoList api 구현
0gonge Mar 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sswugdsc4a.withparents.config;

import com.sswugdsc4a.withparents.filter.JwtAuthorizationFilter;
import com.sswugdsc4a.withparents.repository.LastApiCallTimeRepository;
import com.sswugdsc4a.withparents.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.security.servlet.PathRequest;
Expand All @@ -19,6 +20,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {

private final PropertyConfig propertyConfig;
private final UserRepository userRepository;
private final LastApiCallTimeRepository lastApiCallTimeRepository;

@Override
protected void configure(HttpSecurity http) throws Exception {
Expand All @@ -32,7 +34,7 @@ protected void configure(HttpSecurity http) throws Exception {

// jwt 필터 추가
http.addFilterAfter(
new JwtAuthorizationFilter(userRepository, propertyConfig),
new JwtAuthorizationFilter(userRepository, lastApiCallTimeRepository, propertyConfig),
BasicAuthenticationFilter.class
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public MedicationDTO createMedication(
body.getUserId(),
body.getDescription(),
body.getDayOfTheWeekList(),
body.getDosingTime()
body.getDosingTimeList(),
body.getNotificationStatus()
);
}

Expand All @@ -35,7 +36,8 @@ public MedicationDTO modifyMedication(
body.getMedicationId(),
body.getDescription(),
body.getDayOfTheWeekList(),
body.getDosingTime()
body.getDosingTimeList(),
body.getNotificationStatus()
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.sswugdsc4a.withparents.controller;

import com.sswugdsc4a.withparents.dto.Request.gallery.ModifyPhotoRequest;
import com.sswugdsc4a.withparents.dto.dto.photo.PhotoDTO;
import com.sswugdsc4a.withparents.dto.request.gallery.UploadPhotoRequest;
import com.sswugdsc4a.withparents.entity.Family;
import com.sswugdsc4a.withparents.service.PhotoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class PhotoController {

private final PhotoService photoService;

@PostMapping("/api/gallery/uploadPhoto")
public PhotoDTO uploadPhoto(
@RequestBody UploadPhotoRequest body
){
return photoService.uploadPhoto(
body.getImageUrl(),
body.getDescription()
);
}
@PatchMapping("/api/gallery/modifyPhoto")
public PhotoDTO modifyPhoto(
@RequestBody ModifyPhotoRequest body
){
return photoService.modifyPhoto(
body.getPhotoId(),
body.getImageUrl(),
body.getDescription()
);
}
@DeleteMapping("/api/gallery/deletePhoto")
public void deletePhoto(
@RequestParam Long photoId
){
photoService.deletePhoto(photoId);
}

@GetMapping("/api/gallery/getPhotoList")
public List<PhotoDTO> getPhotoList(
@RequestParam Long familyId
){
return photoService.getPhotoList(familyId);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.sswugdsc4a.withparents.controller;

import com.sswugdsc4a.withparents.dto.Request.schedule.ModifyScheduleRequest;
import com.sswugdsc4a.withparents.dto.dto.ScheduleDTO;
import com.sswugdsc4a.withparents.dto.request.schedule.CreateScheduleRequest;
import com.sswugdsc4a.withparents.service.ScheduleService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class ScheduleController {
private final ScheduleService scheduleService;

@PostMapping("/api/schedule/createSchedule")
public ScheduleDTO createSchedule(
@RequestBody CreateScheduleRequest body
) {
return scheduleService.createSchedule(
body.getTitle(),
body.getDate(),
body.getTime(),
body.getNotificationStatus()
);
}
@PatchMapping("/api/schedule/modifySchedule")
public ScheduleDTO modifySchedule(
@RequestBody ModifyScheduleRequest body
){
return scheduleService.modifySchedule(
body.getScheduleId(),
body.getTitle(),
body.getDate(),
body.getTime(),
body.getNotificationStatus()
);
}


@GetMapping("/api/schedule/getScheduleList")
public List<ScheduleDTO> getScheduleList(
@RequestParam int year,
@RequestParam int month
) {
return scheduleService.getScheduleList(year, month);
}

@GetMapping("/api/schedule/getTodayScheduleList")
public List<ScheduleDTO> getTodayScheduleList(
) {
return scheduleService.getTodayScheduleList();
}

@DeleteMapping("/api/schedule/deleteSchedule")
public void deleteSchedule(
@RequestParam Long scheduleId
){
scheduleService.deleteSchedule(scheduleId);
}
};

Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.sswugdsc4a.withparents.controller;

import com.sswugdsc4a.withparents.dto.dto.user.FamilyDTO;
import com.sswugdsc4a.withparents.dto.dto.user.LocationInfoDTO;
import com.sswugdsc4a.withparents.dto.dto.user.SimpleUserInfoDTO;
import com.sswugdsc4a.withparents.dto.dto.user.UserDTO;
import com.sswugdsc4a.withparents.dto.dto.user.*;
import com.sswugdsc4a.withparents.dto.request.user.CreateFamilyRequest;
import com.sswugdsc4a.withparents.dto.request.user.ModifyUserInfoRequest;
import com.sswugdsc4a.withparents.dto.request.user.SetLocationInfoRequest;
import com.sswugdsc4a.withparents.entity.LastApiCallTime;
import com.sswugdsc4a.withparents.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

Expand Down Expand Up @@ -47,19 +48,30 @@ public UserDTO getUserInfo(){
public LocationInfoDTO setLocationInfo(
@RequestBody SetLocationInfoRequest body
){
return userService.setLocationInfo(body.getLocationInfo());
return userService.setLocationInfo(
body.getLatitude(),
body.getLatitude());
}

@GetMapping("/api/user/getLocationInfo")
public LocationInfoDTO getLocationInfo(
@RequestParam Long userId
){
return userService.getLocationInfo(userId);
public List<LocationAndNicknameDTO> getLocationInfo(){
return userService.getLocationInfo();
}

@GetMapping("/api/user/getFamilyMemberList")
public List<SimpleUserInfoDTO> getFamilyMemberIdList(){
return userService.getFamilyMemberList();
}


@GetMapping("/api/user/getHomeInfo")
public HomeInfoDTO getHomeInfo() {
return userService.getHomeInfo();
}

@GetMapping("/api/user/getParentsLastApiCallTime")
public List<LastApiCallTime> getParentsLastApiCallTime(){
return userService.getParentsLastApiCallTime();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.sswugdsc4a.withparents.dto.Request.gallery;

import lombok.Getter;

@Getter
public class ModifyPhotoRequest {

private Long photoId;
private String imageUrl;
private String description;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.sswugdsc4a.withparents.dto.request.gallery;

import lombok.Getter;

@Getter
public class UploadPhotoRequest {
private Long familyId;
private String imageUrl;
private String description;

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import lombok.Getter;

import java.time.LocalTime;
import java.util.List;

@Getter
public class CreateMedicationRequest {

private Long userId;
private String description;
private String dayOfTheWeekList;
private LocalTime dosingTime;

private List<LocalTime> dosingTimeList;
private Boolean notificationStatus;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class ModifyMedicationRequest {
private Long medicationId;
private String description;
private String dayOfTheWeekList;
private LocalTime dosingTime;
private List<LocalTime> dosingTimeList;
private Boolean notificationStatus;;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.sswugdsc4a.withparents.dto.request.schedule;

import lombok.Getter;

import java.time.LocalDate;
import java.time.LocalTime;

@Getter
public class CreateScheduleRequest {
private String title;
private LocalDate date;
private LocalTime time;
private Boolean notificationStatus;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.sswugdsc4a.withparents.dto.Request.schedule;


import lombok.Getter;

import java.time.LocalDate;
import java.time.LocalTime;

@Getter
public class ModifyScheduleRequest {

private Long scheduleId;
private String title;
private LocalDate date;
private LocalTime time;
private Boolean notificationStatus;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

@Getter
public class SetLocationInfoRequest {
private String locationInfo;
private String latitude;
private String longitude;
}
33 changes: 33 additions & 0 deletions src/main/java/com/sswugdsc4a/withparents/dto/dto/ScheduleDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.sswugdsc4a.withparents.dto.dto;

import com.sswugdsc4a.withparents.entity.Schedule;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;
import java.time.LocalTime;

@Getter
@Setter
@AllArgsConstructor
public class ScheduleDTO {

private Long id;
private Long creatorId;
private String title;
private LocalDate date;
private LocalTime time;
private Boolean notificationStatus;

public static ScheduleDTO entityToDTO(Schedule e){
return new ScheduleDTO(
e.getId(),
e.getCreator().getId(),
e.getTitle(),
e.getDate(),
e.getTime(),
e.getNotificationState()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import lombok.Setter;

import java.time.LocalTime;
import java.util.List;
import java.util.stream.Collectors;

@Getter
@Setter
Expand All @@ -16,15 +18,20 @@ public class MedicationDTO {
private Long userId;
private String description;
private String dayOfTheWeekList;
private LocalTime dosingTime;
private List<LocalTime> dosingTimes;
private Boolean notificationStatus;

public static MedicationDTO entityToDto(Medication e){
return new MedicationDTO(
e.getId(),
e.getUser().getId(),
e.getDescription(),
e.getDayOfTheWeekList(),
e.getDosingTime()
e.getDosingTimeList()
.stream()
.map(t -> {return t.getTime();})
.collect(Collectors.toList()),
e.getNotificationStatus()
);
}

Expand Down
Loading