controllers

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllForecats

func GetAllForecats(mongoClient *mongo.Client) gin.HandlerFunc

GetAllForecats godoc

@Summary		Get all foracasts
@Description	Fetch all existing forecasts
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200			{object}	models.ForecastsResponse{}
@Failure		400			{object}	models.ErrorResponse{}	"Some params are missing and/or not properly formatted fror the requests"
@Failure		500			{object}	models.ErrorResponse{}	"An error occured on the server side"
@Param			from		query		string					false	"The date to filter from (RFC3339)"		Format(date-time)
@Param			limit		query		int						true	"Set the limit of the queried results"	Format(int)	default(10)
@Param			offset		query		int						true	"Set the offset of the queried results"	Format(int)	default(0)
@Param			reason		query		string					false	"The closing reason"					Enums(boat, maintenance)
@Param			boat		query		string					false	"The boat name of the event"
@Param			maneuver	query		string					false	"The boat maneuver of the event"								Enums(leaving_bordeaux, entering_in_bordeaux)
@Param			Timezone	header		string					false	"Timezone to format the date related fields (TZ identifier)"	default(UTC)
@Router			/forecasts [get]

func GetForecastByID

func GetForecastByID(mongoClient *mongo.Client) gin.HandlerFunc

GetForecastByID godoc

@Summary		Get a foracast
@Description	Fetch a forecast by his unique ID
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200			{object}	models.ForecastResponse{}
@Failure		404			{object}	models.ErrorResponse{}	"The ID does not match any forecast"
@Failure		400			{object}	models.ErrorResponse{}	"Some params are missing and/or not properly formatted fror the requests"
@Failure		500			{object}	models.ErrorResponse{}	"An error occured on the server side"
@Param			id			path		string					true	"The forecast ID"
@Param			Timezone	header		string					false	"Timezone to format the date related fields (TZ identifier)"	default(UTC)
@Router			/forecasts/{id} [get]

func GetLastRefreshAction

func GetLastRefreshAction(mongoClient *mongo.Client) gin.HandlerFunc

GetLastRefreshAction godoc

@Summary		Get the last refresh action
@Description	Get the last trace of refresh action on POST /management/refresh
@Tags			Management
@Produce		json
@Success		200	{object}	models.Refresh{}
@Failure		404	{object}	models.ErrorResponse{}	"No previous refresh action exists"
@Failure		500	{object}	models.ErrorResponse{}	"An error occured on the server side"
@Router			/management/refresh/last [get]

func Healthcheck

func Healthcheck(mongoClient *mongo.Client) gin.HandlerFunc

Healthcheck godoc

@Summary	Get the status of the API
@Tags		Misc
@Produce	json
@Success	200	{object}	models.OKResponse{}		"The api is healthy"
@Failure	503	{object}	models.ErrorResponse{}	"The api is unhealthy"
@Router		/healthcheck [get]

func RefreshForcast

func RefreshForcast(mongoClient *mongo.Client) gin.HandlerFunc

RefreshForcast godoc

@Summary		Refresh the data with the ones from the OpenData API
@Description	Get, format et populate database with the data from the OpenData API
@Tags			Management
@Accept			json
@Produce		json
@Success		200	{object}	models.Refresh{}
@Failure		500	{object}	models.ErrorResponse{}	"An error occured on the server side"
@Failure		429	{object}	models.ErrorResponse{}	"Too many attempt to refresh"
@Router			/management/refresh [post]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL