controllers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ForecastController added in v0.1.0

type ForecastController struct {
	ForecastUseCase domains.ForecastUseCase
}

func (*ForecastController) GetAllForecasts added in v0.1.0

func (fC *ForecastController) GetAllForecasts() gin.HandlerFunc

GetAllForecasts godoc

@Summary		Get all forecasts
@Description	Fetch all existing forecasts
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200			{object}	domains.ForecastsResponse{}
@Failure		400			{object}	domains.APIErrorResponse{}	"Some params are missing and/or not properly formatted from the requests"
@Failure		500			{object}	domains.APIErrorResponse{}	"An error occurred 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, wine_festival_boats, special_event)
@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 (*ForecastController) GetCurrentForecast added in v0.1.0

func (fC *ForecastController) GetCurrentForecast() gin.HandlerFunc

GetCurrentForecast godoc

@Summary		Fetch the current forecast
@Description	Get the current forecast (the bridge is currently closed)
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200			{object}	domains.ForecastResponse{}
@Failure		404			{object}	domains.APIErrorResponse{}	"The Chaban-Delmas bridge is currently open"
@Failure		400			{object}	domains.APIErrorResponse{}	"Some params are missing and/or not properly formatted from the requests"
@Failure		500			{object}	domains.APIErrorResponse{}	"An error occurred on the server side"
@Param			Timezone	header		string						false	"Timezone to format the date related fields (TZ identifier)"	default(UTC)
@Router			/forecasts/current [get]

func (*ForecastController) GetForecastByID added in v0.1.0

func (fC *ForecastController) GetForecastByID() gin.HandlerFunc

GetForecastByID godoc

@Summary		Get a forecast
@Description	Fetch a forecast by his unique ID
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200			{object}	domains.ForecastResponse{}
@Failure		404			{object}	domains.APIErrorResponse{}	"The ID does not match any forecast"
@Failure		400			{object}	domains.APIErrorResponse{}	"Some params are missing and/or not properly formatted from the requests"
@Failure		500			{object}	domains.APIErrorResponse{}	"An error occurred 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 (*ForecastController) GetNextForecast added in v0.1.0

func (fC *ForecastController) GetNextForecast() gin.HandlerFunc

GetNextForecast godoc

@Summary		Fetch the next forecast
@Description	Get the next forecast (= current forecast if the bridge is closed)
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200			{object}	domains.ForecastResponse{}
@Failure		404			{object}	domains.APIErrorResponse{}	"The city of Bordeaux has not yet posted the closing times online"
@Failure		400			{object}	domains.APIErrorResponse{}	"Some params are missing and/or not properly formatted from the requests"
@Failure		500			{object}	domains.APIErrorResponse{}	"An error occurred on the server side"
@Param			Timezone	header		string						false	"Timezone to format the date related fields (TZ identifier)"	default(UTC)
@Router			/forecasts/next [get]

func (*ForecastController) GetTodayForecasts added in v0.1.0

func (fC *ForecastController) GetTodayForecasts() gin.HandlerFunc

GetTodayForecasts godoc

@Summary		Get the closing schedule for today
@Description	Get the closing schedule for today
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200			{object}	domains.ForecastsResponse{}
@Failure		400			{object}	domains.APIErrorResponse{}	"Some params are missing and/or not properly formatted for the requests"
@Failure		500			{object}	domains.APIErrorResponse{}	"An error occurred on the server side"
@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			Timezone	header		string						false	"Timezone to format the date related fields (TZ identifier)"	default(UTC)
@Router			/forecasts/today [get]

func (*ForecastController) SyncForecasts added in v0.1.0

func (fC *ForecastController) SyncForecasts() gin.HandlerFunc

SyncForecasts godoc

@Summary		Sync the forecasts with the ones from the OpenData API
@Description	Get, format et populate database with the data from the OpenData API
@Tags			Forecasts
@Accept			json
@Produce		json
@Success		200	{object}	domains.Sync{}
@Failure		500	{object}	domains.APIErrorResponse{}	"An error occurred on the server side"
@Failure		429	{object}	domains.APIErrorResponse{}	"Too many attempt to sync"
@Router			/forecasts/sync [post]

type SyncController added in v0.1.0

type SyncController struct {
	SyncUseCase domains.SyncUseCase
}

func (*SyncController) GetLastSyncAction added in v0.1.0

func (mC *SyncController) GetLastSyncAction() gin.HandlerFunc

GetLastSyncAction godoc

@Summary		Get the last sync action
@Description	Get the last trace of sync action on POST /forecasts/sync
@Tags			Syncs
@Produce		json
@Success		200	{object}	domains.Sync{}
@Failure		404	{object}	domains.APIErrorResponse{}	"No previous sync action exists"
@Failure		500	{object}	domains.APIErrorResponse{}	"An error occurred on the server side"
@Router			/syncs/last [get]

type SystemController added in v0.1.0

type SystemController struct {
	HealthCheckUseCase domains.HealthCheckUsecase
}

func (*SystemController) Healthcheck added in v0.1.0

func (sC *SystemController) Healthcheck() gin.HandlerFunc

Healthcheck godoc

@Summary	Get the status of the API
@Tags		System
@Produce	json
@Success	200	{object}	domains.SystemHealthNOK{}	"The api is healthy"
@Failure	503	{object}	domains.SystemHealthOK{}	"The api is unhealthy"
@Router		/system/healthcheck [get]

Jump to

Keyboard shortcuts

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