Skip to content

Commit

Permalink
feat: 안심구역 전체 반환 라우트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin0409 committed Jun 20, 2024
1 parent 6c1bdc1 commit e65c1d6
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion backend/fastapi/app/routes2.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
@router.post("/test/fcm", description="FCM 테스트")
async def send_fcm(request: FCMRequest):

send_push_notification(request.token, request.title, request.body, request.data)
await send_push_notification(request.token, request.title, request.body, request.data)

return {"status": "success", "message": "FCM sent"}

Expand Down Expand Up @@ -1073,6 +1073,37 @@ async def get_safe_area_group_info(dementiaKey: str, groupKey: str):
finally:
session.close()

@router.get("/safeArea/info/all", responses = {200 : {"model" : GetSafeAreaAllResponse, "description" : "전체 안전 지역 정보 전송 성공" }, 404: {"model": ErrorResponse, "description": "안전 지역 정보 없음"}}, description="보호 대상자의 전체 안전 지역 정보 전달(쿼리 스트링)")
async def get_safe_area_all_info(dementiaKey: str):
try:
safe_area_list = session.query(models.safe_area_info).filter_by(dementia_key = dementiaKey).all()

areas = []

for area in safe_area_list:
new_area = {
'areaName' : area.area_name,
'latitude' : area.latitude,
'longitude' : area.longitude,
'radius' : area.radius
}
areas.append(new_area)

result = {
'safeAreas': areas
}

response = {
'status': 'success',
'message': 'Safe area information sent',
'result': result
}

return response

finally:
session.close()

@router.post("/safeArea/modification/name", responses = {200 : {"model" : CommonResponse, "description" : "안전 지역 정보 수정 성공" }, 400 : {"model" : ErrorResponse, "description" : "안심 구역 이름 중복"},404: {"model": ErrorResponse, "description": "안전 지역 정보 없음"}}, description="보호 대상자의 안전 지역 정보 수정")
async def modify_name_safe_area_info(request: ModifySafeAreaName):
try:
Expand Down

0 comments on commit e65c1d6

Please sign in to comment.