11import json
2+ from http import HTTPStatus
23
34import azure .functions as func
45
@@ -20,7 +21,7 @@ def get_latest_entries(req: func.HttpRequest) -> func.HttpResponse:
2021 if not owner_id :
2122 return func .HttpResponse (
2223 body = "No owner id found" ,
23- status_code = 404 ,
24+ status_code = HTTPStatus . NOT_FOUND ,
2425 mimetype = "application/json"
2526 )
2627
@@ -29,19 +30,19 @@ def get_latest_entries(req: func.HttpRequest) -> func.HttpResponse:
2930 if not time_entries or len (time_entries ) == 0 :
3031 return func .HttpResponse (
3132 body = "No time entries found" ,
32- status_code = 404 ,
33+ status_code = HTTPStatus . NOT_FOUND ,
3334 mimetype = "application/json"
3435 )
3536
3637 return func .HttpResponse (
3738 body = json .dumps (time_entries , default = str ),
38- status_code = 200 ,
39+ status_code = HTTPStatus . OK ,
3940 mimetype = "application/json" ,
4041 )
4142
4243 except ValueError :
4344 return func .HttpResponse (
4445 body = b"Invalid Format ID" ,
45- status_code = 400 ,
46+ status_code = HTTPStatus . BAD_REQUEST ,
4647 mimetype = "application/json"
4748 )
0 commit comments