Skip to content

Commit

Permalink
Reformed endpoint swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismail731404 committed Dec 5, 2023
1 parent e257886 commit 5e1325b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
22 changes: 4 additions & 18 deletions internals/handlers/history_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,12 @@ import (

// @Summary Get Today's Fact Result by Criteria
// @Description Fetches the result of a historical fact based on provided criteria for today's date.
// @Description Example Request:
// @Description <pre>{
// @Description "factID": 123,
// @Description "situationId": 456,
// @Description "situationInstanceId": 789
// @Description }</pre>
// @Tags Facts_history
// @Accept json
// @Produce json
// @Param history.ParamGetFactHistory body interface{} true "JSON payload containing criteria for fetching today's history fact result."
// @Param factHistory body history.ParamGetFactHistory true "JSON payload containing criteria for fetching today's history fact result."
// @Security Bearer
// @Success 200 "Successfully fetched result"
// @Success 200 {object} history.FactResult "Successfully fetched result"
// @Failure 400 "Status Bad Request"
// @Failure 500 "Status" internal server error"
// @Router /engine/history/facts/today/result [post]
Expand Down Expand Up @@ -55,21 +49,13 @@ func GetFactResultForTodayByCriteria(w http.ResponseWriter, r *http.Request) {

// @Summary Get Fact Result by Date Criteria
// @Description Fetches the result of a historical fact based on provided criteria within specified date range.
// @Description Example Request:
// @Description <pre>{
// @Description "factID": 42,
// @Description "situationId": 29,
// @Description "situationInstanceId": 572,
// @Description "startDate": "2023-01-01 00:00:00",
// @Description "endDate": "2023-12-30 00:00:00"
// @Description }</pre>
// The dates should be in the format "2006-01-02 15:04:05".
// @Tags Facts_history
// @Accept json
// @Produce json
// @Param history.ParamGetFactHistoryByDate body interface{} true "JSON payload containing criteria and date range for fetching history fact result, with dates in '2006-01-02 15:04:05' format."
// @Param factHistory body history.ParamGetFactHistoryByDate true "JSON payload containing criteria and date range for fetching history fact result, with dates in '2006-01-02 15:04:05' format."
// @Security Bearer
// @Success 200 "Successfully fetched result"
// @Success 200 {object} history.FactResult "Successfully fetched result"
// @Failure 400 "Status Bad Request"
// @Failure 500 "Status Internal Server Error"
// @Router /engine/history/facts/date/result [post]
Expand Down
2 changes: 1 addition & 1 deletion internals/history/fact_history_querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type GetFactHistory struct {

type FactResult struct {
Value int64 `json:"value"`
FormattedTime string `json:"formattedTime"`
FormattedTime string `json:"formattedTime" example:"2006-01-02 15:04:05"`
}

type ParamGetFactHistory struct {
Expand Down

0 comments on commit 5e1325b

Please sign in to comment.