handlers

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderCrewEntriesRenamed = "X-Crew-Entries-Renamed"

HeaderCrewEntriesRenamed reports how many flight crew entries a contact rename rewrote. Must stay listed in the CORS ExposeHeaders in cmd/api/main.go.

Variables

View Source
var (
	// AuthLoginAttemptsTotal counts login attempts by result.
	AuthLoginAttemptsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "auth_login_attempts_total",
			Help: "Total number of login attempts.",
		},
		[]string{"result"},
	)

	// AuthTokenRefreshTotal counts token refresh attempts by result.
	AuthTokenRefreshTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "auth_token_refresh_total",
			Help: "Total number of token refresh attempts.",
		},
		[]string{"result"},
	)

	// Auth2FAAttemptsTotal counts 2FA verification attempts by result.
	Auth2FAAttemptsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "auth_2fa_attempts_total",
			Help: "Total number of 2FA verification attempts.",
		},
		[]string{"result"},
	)

	// OIDCLoginAttemptsTotal counts steps of the OIDC login flow by result.
	// Zero on deployments that do not use OIDC.
	OIDCLoginAttemptsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "auth_oidc_login_attempts_total",
			Help: "Total number of OIDC login flow steps by result.",
		},
		[]string{"result"},
	)
)

Functions

func FrontendBaseURL added in v1.3.2

func FrontendBaseURL() string

FrontendBaseURL resolves the canonical frontend origin used to build links embedded in outbound emails: FRONTEND_URL, then the first comma-separated CORS_ORIGIN entry, then localhost.

func StartImportSessionReaper added in v1.3.1

func StartImportSessionReaper(ctx context.Context, interval time.Duration)

StartImportSessionReaper evicts expired upload sessions on a timer.

Types

type APIHandler

type APIHandler struct {
	// contains filtered or unexported fields
}

APIHandler implements the generated.ServerInterface from OpenAPI spec

func NewAPIHandler

func NewAPIHandler(
	authService *service.AuthService,
	licenseService *service.LicenseService,
	flightService *service.FlightService,
	credentialService *service.CredentialService,
	aircraftService *service.AircraftService,
	notificationService *service.NotificationService,
	twoFactorService *service.TwoFactorService,
	contactService *service.ContactService,
	classRatingService *service.ClassRatingService,
	currencyService *currency.Service,
	webauthnService *service.WebAuthnService,
	jwtManager *jwt.Manager,
	flightCrewRepo repository.FlightCrewRepository,
	adminEmail string,
) *APIHandler

NewAPIHandler creates a new unified API handler that implements the OpenAPI ServerInterface

func (*APIHandler) AttachCrewMembers added in v1.2.4

func (h *APIHandler) AttachCrewMembers(ctx context.Context, flights []*models.Flight)

AttachCrewMembers is the exported wrapper used by the cloud-backup JSON builder so it can reuse the same crew enrichment pathway as the HTTP export handler.

func (*APIHandler) AuthorizeOidc added in v1.3.7

func (h *APIHandler) AuthorizeOidc(c *gin.Context, params generated.AuthorizeOidcParams)

AuthorizeOidc implements GET /auth/oidc/authorize.

Starts a login: mints the state, nonce and PKCE verifier, plants the browser-binding cookie, and redirects to the provider. `native=1` finishes the login at the native redirect URI instead of the web frontend.

func (*APIHandler) BackupPayloadBuilder added in v1.3.7

func (h *APIHandler) BackupPayloadBuilder() *cloudbackup.DefaultJSONBuilder

ExportDataJSON implements GET /exports/json BackupPayloadBuilder composes the services that make up a backup payload. GET /exports/json and every cloud backup run share it, so the two can never carry different sets of a user's data.

func (*APIHandler) ChangePassword

func (h *APIHandler) ChangePassword(c *gin.Context)

ChangePassword implements POST /auth/change-password (POST /auth/change-password)

func (*APIHandler) CleanupTokens

func (h *APIHandler) CleanupTokens(c *gin.Context)

CleanupTokens implements POST /admin/maintenance/cleanup-tokens

func (*APIHandler) CleanupUnverifiedAccounts added in v1.3.2

func (h *APIHandler) CleanupUnverifiedAccounts(c *gin.Context)

CleanupUnverifiedAccounts implements POST /admin/maintenance/cleanup-unverified

func (*APIHandler) CompletePublicSignature added in v1.2.9

func (h *APIHandler) CompletePublicSignature(c *gin.Context, token generated.SignatureToken)

CompletePublicSignature implements POST /sign/{token}

func (*APIHandler) ConfirmImport

func (h *APIHandler) ConfirmImport(c *gin.Context)

ConfirmImport implements POST /imports/confirm

func (*APIHandler) CreateAircraft

func (h *APIHandler) CreateAircraft(c *gin.Context)

CreateAircraft implements POST /aircraft (POST /aircraft)

func (*APIHandler) CreateAnnouncement

func (h *APIHandler) CreateAnnouncement(c *gin.Context)

CreateAnnouncement implements POST /admin/announcements

func (*APIHandler) CreateBackupDestination added in v1.2.4

func (h *APIHandler) CreateBackupDestination(c *gin.Context)

CreateBackupDestination wires up a new destination for the current user.

func (*APIHandler) CreateClassRating

func (h *APIHandler) CreateClassRating(c *gin.Context, licenseId generated.LicenseId)

func (*APIHandler) CreateContact

func (h *APIHandler) CreateContact(c *gin.Context)

CreateContact handles POST /contacts

func (*APIHandler) CreateCredential

func (h *APIHandler) CreateCredential(c *gin.Context)

CreateCredential implements POST /credentials

func (*APIHandler) CreateCustomCurrencyRule added in v1.3.7

func (h *APIHandler) CreateCustomCurrencyRule(c *gin.Context)

CreateCustomCurrencyRule implements POST /custom-currency.

func (*APIHandler) CreateFlight

func (h *APIHandler) CreateFlight(c *gin.Context)

CreateFlight implements POST /flights (POST /flights)

func (*APIHandler) CreateLicense

func (h *APIHandler) CreateLicense(c *gin.Context)

CreateLicense implements POST /licenses (POST /licenses)

func (*APIHandler) CreateSignatureRequest added in v1.2.9

func (h *APIHandler) CreateSignatureRequest(c *gin.Context, flightId generated.FlightId)

CreateSignatureRequest implements POST /flights/{flightId}/signatures

func (*APIHandler) DeleteAircraft

func (h *APIHandler) DeleteAircraft(c *gin.Context, aircraftId generated.AircraftId)

DeleteAircraft implements DELETE /aircraft/{aircraftId} (DELETE /aircraft/{aircraftId})

func (*APIHandler) DeleteAllFlights

func (h *APIHandler) DeleteAllFlights(c *gin.Context)

DeleteAllFlights implements DELETE /flights/delete-all

func (*APIHandler) DeleteAllUserData

func (h *APIHandler) DeleteAllUserData(c *gin.Context)

DeleteAllUserData implements DELETE /users/me/data

func (*APIHandler) DeleteAnnouncement

func (h *APIHandler) DeleteAnnouncement(c *gin.Context, announcementId openapi_types.UUID)

DeleteAnnouncement implements DELETE /admin/announcements/{announcementId}

func (*APIHandler) DeleteBackupDestination added in v1.2.4

func (h *APIHandler) DeleteBackupDestination(c *gin.Context, destinationID generated.BackupDestinationId)

DeleteBackupDestination removes a destination.

func (*APIHandler) DeleteClassRating

func (h *APIHandler) DeleteClassRating(c *gin.Context, licenseId generated.LicenseId, ratingId openapi_types.UUID)

func (*APIHandler) DeleteContact

func (h *APIHandler) DeleteContact(c *gin.Context, contactId openapi_types.UUID)

DeleteContact handles DELETE /contacts/{contactId}

func (*APIHandler) DeleteCredential

func (h *APIHandler) DeleteCredential(c *gin.Context, credentialId generated.CredentialId)

DeleteCredential implements DELETE /credentials/{credentialId}

func (*APIHandler) DeleteCredentialFile added in v1.3.2

func (h *APIHandler) DeleteCredentialFile(c *gin.Context, credentialId generated.CredentialId, fileId generated.DocumentFileId)

DeleteCredentialFile implements DELETE /credentials/{credentialId}/files/{fileId}

func (*APIHandler) DeleteCurrentUser

func (h *APIHandler) DeleteCurrentUser(c *gin.Context)

DeleteCurrentUser implements DELETE /users/me (DELETE /users/me)

func (*APIHandler) DeleteCustomCurrencyRule added in v1.3.7

func (h *APIHandler) DeleteCustomCurrencyRule(c *gin.Context, ruleID generated.CustomCurrencyRuleId)

DeleteCustomCurrencyRule implements DELETE /custom-currency/{ruleId}.

func (*APIHandler) DeleteEmailSuppression added in v1.3.2

func (h *APIHandler) DeleteEmailSuppression(c *gin.Context, email openapi_types.Email)

DeleteEmailSuppression implements DELETE /admin/email/suppressions/{email}

func (*APIHandler) DeleteFlight

func (h *APIHandler) DeleteFlight(c *gin.Context, flightId generated.FlightId)

DeleteFlight implements DELETE /flights/{flightId} (DELETE /flights/{flightId})

func (*APIHandler) DeleteLicense

func (h *APIHandler) DeleteLicense(c *gin.Context, licenseId generated.LicenseId)

DeleteLicense implements DELETE /licenses/{licenseId} (DELETE /licenses/{licenseId})

func (*APIHandler) DeleteLicenseFile added in v1.3.2

func (h *APIHandler) DeleteLicenseFile(c *gin.Context, licenseId generated.LicenseId, fileId generated.DocumentFileId)

DeleteLicenseFile implements DELETE /licenses/{licenseId}/files/{fileId}

func (*APIHandler) DeleteMyBaseline added in v1.2.3

func (h *APIHandler) DeleteMyBaseline(c *gin.Context)

DeleteMyBaseline implements DELETE /users/me/baseline.

func (*APIHandler) DeleteUser added in v1.2.3

func (h *APIHandler) DeleteUser(c *gin.Context, userId openapi_types.UUID)

DeleteUser implements DELETE /admin/users/{userId} Permanently deletes a user and all of their content via FK ON DELETE CASCADE.

func (*APIHandler) DeleteWebauthnCredential added in v1.2.0

func (h *APIHandler) DeleteWebauthnCredential(c *gin.Context, credentialId openapi_types.UUID)

DeleteWebauthnCredential implements DELETE /auth/webauthn/credentials/{credentialId}

func (*APIHandler) Disable2FA

func (h *APIHandler) Disable2FA(c *gin.Context)

Disable2FA implements POST /auth/2fa/disable

func (*APIHandler) DisableCustomCurrencyRuleShare added in v1.3.7

func (h *APIHandler) DisableCustomCurrencyRuleShare(c *gin.Context, ruleID generated.CustomCurrencyRuleId)

DisableCustomCurrencyRuleShare implements DELETE /custom-currency/{ruleId}/share.

func (*APIHandler) DisableUser

func (h *APIHandler) DisableUser(c *gin.Context, userId openapi_types.UUID)

DisableUser implements POST /admin/users/{userId}/disable

func (*APIHandler) DiscardCurrentFlightSession added in v1.2.8

func (h *APIHandler) DiscardCurrentFlightSession(c *gin.Context)

DiscardCurrentFlightSession implements DELETE /flight-sessions/current (DELETE /flight-sessions/current)

func (*APIHandler) EnableCustomCurrencyRuleShare added in v1.3.7

func (h *APIHandler) EnableCustomCurrencyRuleShare(c *gin.Context, ruleID generated.CustomCurrencyRuleId)

EnableCustomCurrencyRuleShare implements POST /custom-currency/{ruleId}/share.

func (*APIHandler) EnableUser

func (h *APIHandler) EnableUser(c *gin.Context, userId openapi_types.UUID)

EnableUser implements POST /admin/users/{userId}/enable

func (*APIHandler) ExchangeOidcCode added in v1.3.2

func (h *APIHandler) ExchangeOidcCode(c *gin.Context)

ExchangeOidcCode implements POST /auth/oidc/exchange

func (*APIHandler) ExportContactsVCard added in v1.3.3

func (h *APIHandler) ExportContactsVCard(c *gin.Context)

ExportContactsVCard handles GET /exports/vcard

func (*APIHandler) ExportDataJSON

func (h *APIHandler) ExportDataJSON(c *gin.Context)

ExportDataJSON implements GET /exports/json.

func (*APIHandler) ExportFlightsCSV

func (h *APIHandler) ExportFlightsCSV(c *gin.Context, params generated.ExportFlightsCSVParams)

ExportFlightsCSV implements GET /exports/csv

func (*APIHandler) ExportFlightsPDF

func (h *APIHandler) ExportFlightsPDF(c *gin.Context, params generated.ExportFlightsPDFParams)

ExportFlightsPDF implements GET /exports/pdf

func (*APIHandler) GetAdminConfig

func (h *APIHandler) GetAdminConfig(c *gin.Context)

GetAdminConfig implements GET /admin/config

func (*APIHandler) GetAdminStats

func (h *APIHandler) GetAdminStats(c *gin.Context)

GetAdminStats implements GET /admin/stats

func (*APIHandler) GetAircraft

func (h *APIHandler) GetAircraft(c *gin.Context, aircraftId generated.AircraftId)

GetAircraft implements GET /aircraft/{aircraftId} (GET /aircraft/{aircraftId})

func (*APIHandler) GetAircraftStats added in v1.3.1

func (h *APIHandler) GetAircraftStats(c *gin.Context)

GetAircraftStats implements GET /aircraft/stats (GET /aircraft/stats)

func (*APIHandler) GetAirport

func (h *APIHandler) GetAirport(c *gin.Context, icaoCode string)

GetAirport implements GET /airports/{icaoCode}

func (*APIHandler) GetAirportPack added in v1.3.5

func (h *APIHandler) GetAirportPack(c *gin.Context)

GetAirportPack implements GET /airports/pack

func (*APIHandler) GetAirportPackStatus added in v1.3.5

func (h *APIHandler) GetAirportPackStatus(c *gin.Context)

GetAirportPackStatus implements GET /airports/pack/status

func (*APIHandler) GetAirportStats

func (h *APIHandler) GetAirportStats(c *gin.Context)

GetAirportStats implements GET /reports/airport-stats

func (*APIHandler) GetAllCurrencyStatus

func (h *APIHandler) GetAllCurrencyStatus(c *gin.Context)

GetAllCurrencyStatus returns currency status for all class ratings across all licenses

func (*APIHandler) GetAnnouncements

func (h *APIHandler) GetAnnouncements(c *gin.Context)

GetAnnouncements implements GET /announcements Returns active system announcements + auto-generated user hints

func (*APIHandler) GetAuthProviders added in v1.3.2

func (h *APIHandler) GetAuthProviders(c *gin.Context)

GetAuthProviders implements GET /auth/providers. Unauthenticated; exposes only which sign-in methods exist.

func (*APIHandler) GetBackupDestination added in v1.2.4

func (h *APIHandler) GetBackupDestination(c *gin.Context, destinationID generated.BackupDestinationId)

GetBackupDestination returns one destination by ID.

func (*APIHandler) GetBackupRun added in v1.2.4

func (h *APIHandler) GetBackupRun(c *gin.Context, runID openapi_types.UUID)

GetBackupRun returns a single run scoped to the calling user.

func (*APIHandler) GetContact

func (h *APIHandler) GetContact(c *gin.Context, contactId openapi_types.UUID)

GetContact handles GET /contacts/{contactId}

func (*APIHandler) GetCredential

func (h *APIHandler) GetCredential(c *gin.Context, credentialId generated.CredentialId)

GetCredential implements GET /credentials/{credentialId}

func (*APIHandler) GetCredentialFile added in v1.3.2

func (h *APIHandler) GetCredentialFile(c *gin.Context, credentialId generated.CredentialId, fileId generated.DocumentFileId)

GetCredentialFile implements GET /credentials/{credentialId}/files/{fileId}

func (*APIHandler) GetCurrentFlightSession added in v1.2.8

func (h *APIHandler) GetCurrentFlightSession(c *gin.Context)

GetCurrentFlightSession implements GET /flight-sessions/current (GET /flight-sessions/current)

func (*APIHandler) GetCurrentUser

func (h *APIHandler) GetCurrentUser(c *gin.Context)

GetCurrentUser implements GET /users/me (GET /users/me)

func (*APIHandler) GetCustomCurrencyRule added in v1.3.7

func (h *APIHandler) GetCustomCurrencyRule(c *gin.Context, ruleID generated.CustomCurrencyRuleId)

GetCustomCurrencyRule implements GET /custom-currency/{ruleId}.

func (*APIHandler) GetFeatures added in v1.3.2

func (h *APIHandler) GetFeatures(c *gin.Context)

GetFeatures implements GET /features — the capability probe a client uses to decide whether to render the image UI at all.

func (*APIHandler) GetFlight

func (h *APIHandler) GetFlight(c *gin.Context, flightId generated.FlightId)

GetFlight implements GET /flights/{flightId} (GET /flights/{flightId})

func (*APIHandler) GetFlightAnalytics added in v1.3.1

func (h *APIHandler) GetFlightAnalytics(c *gin.Context, params generated.GetFlightAnalyticsParams)

GetFlightAnalytics implements GET /reports/analytics

func (*APIHandler) GetFlightRoutes

func (h *APIHandler) GetFlightRoutes(c *gin.Context)

GetFlightRoutes implements GET /reports/routes

func (*APIHandler) GetFlightSignature added in v1.2.9

func (h *APIHandler) GetFlightSignature(c *gin.Context, flightId generated.FlightId, signatureId generated.SignatureId)

GetFlightSignature implements GET /flights/{flightId}/signatures/{signatureId}

func (*APIHandler) GetFlightSignatureImage added in v1.2.9

func (h *APIHandler) GetFlightSignatureImage(c *gin.Context, flightId generated.FlightId, signatureId generated.SignatureId)

GetFlightSignatureImage implements GET /flights/{flightId}/signatures/{signatureId}/image

func (*APIHandler) GetFlightTrends

func (h *APIHandler) GetFlightTrends(c *gin.Context, params generated.GetFlightTrendsParams)

GetFlightTrends implements GET /reports/trends

func (*APIHandler) GetImport

func (h *APIHandler) GetImport(c *gin.Context, importId generated.ImportId)

GetImport implements GET /imports/{importId}

func (*APIHandler) GetLicense

func (h *APIHandler) GetLicense(c *gin.Context, licenseId generated.LicenseId)

GetLicense implements GET /licenses/{licenseId} (GET /licenses/{licenseId})

func (*APIHandler) GetLicenseCurrency

func (h *APIHandler) GetLicenseCurrency(c *gin.Context, licenseId generated.LicenseId)

GetLicenseCurrency implements GET /licenses/{licenseId}/currency (GET /licenses/{licenseId}/currency)

func (*APIHandler) GetLicenseFile added in v1.3.2

func (h *APIHandler) GetLicenseFile(c *gin.Context, licenseId generated.LicenseId, fileId generated.DocumentFileId)

GetLicenseFile implements GET /licenses/{licenseId}/files/{fileId}

func (*APIHandler) GetLicenseStatistics

func (h *APIHandler) GetLicenseStatistics(c *gin.Context, licenseId generated.LicenseId, params generated.GetLicenseStatisticsParams)

GetLicenseStatistics implements GET /licenses/{licenseId}/statistics (GET /licenses/{licenseId}/statistics)

func (*APIHandler) GetMyBaseline added in v1.2.3

func (h *APIHandler) GetMyBaseline(c *gin.Context)

GetMyBaseline implements GET /users/me/baseline.

func (*APIHandler) GetMyStatistics

func (h *APIHandler) GetMyStatistics(c *gin.Context, params generated.GetMyStatisticsParams)

GetMyStatistics implements GET /users/me/statistics

func (*APIHandler) GetNotificationHistory

func (h *APIHandler) GetNotificationHistory(c *gin.Context, params generated.GetNotificationHistoryParams)

GetNotificationHistory implements GET /users/me/notifications/history

func (*APIHandler) GetNotificationPreferences

func (h *APIHandler) GetNotificationPreferences(c *gin.Context)

GetNotificationPreferences implements GET /users/me/notifications

func (*APIHandler) GetPublicSignatureInfo added in v1.2.9

func (h *APIHandler) GetPublicSignatureInfo(c *gin.Context, token generated.SignatureToken)

GetPublicSignatureInfo implements GET /sign/{token}

func (*APIHandler) GetSharedCustomCurrencyRule added in v1.3.7

func (h *APIHandler) GetSharedCustomCurrencyRule(c *gin.Context, shareToken generated.CustomCurrencyShareToken)

GetSharedCustomCurrencyRule implements GET /custom-currency/shared/{shareToken} — a read-only preview.

func (*APIHandler) GetStatsByClass

func (h *APIHandler) GetStatsByClass(c *gin.Context, params generated.GetStatsByClassParams)

GetStatsByClass implements GET /reports/stats-by-class

func (*APIHandler) GetUpdateStatus added in v1.3.5

func (h *APIHandler) GetUpdateStatus(c *gin.Context, params generated.GetUpdateStatusParams)

GetUpdateStatus implements GET /admin/update

func (*APIHandler) ImportDataJSON added in v1.2.3

func (h *APIHandler) ImportDataJSON(c *gin.Context)

ImportDataJSON implements POST /imports/json. It restores a NinerLog JSON backup (as produced by GET /exports/json) into the authenticated user's account. All entity IDs are regenerated so a backup can be restored into any installation, including the one it was exported from. The operation is additive: existing user data is never touched, and aircraft whose registration already exists for the user are skipped (their existing IDs are referenced by imported flights via aircraftReg, no remapping needed).

func (*APIHandler) ImportSharedCustomCurrencyRule added in v1.3.7

func (h *APIHandler) ImportSharedCustomCurrencyRule(c *gin.Context, shareToken generated.CustomCurrencyShareToken)

ImportSharedCustomCurrencyRule implements POST /custom-currency/shared/{shareToken}/import.

func (*APIHandler) ListAdminAuditLog

func (h *APIHandler) ListAdminAuditLog(c *gin.Context, params generated.ListAdminAuditLogParams)

ListAdminAuditLog implements GET /admin/audit-log

func (*APIHandler) ListAdminUsers

func (h *APIHandler) ListAdminUsers(c *gin.Context, params generated.ListAdminUsersParams)

ListAdminUsers implements GET /admin/users

func (*APIHandler) ListAircraft

func (h *APIHandler) ListAircraft(c *gin.Context, params generated.ListAircraftParams)

ListAircraft implements GET /aircraft (GET /aircraft)

func (*APIHandler) ListBackupDestinations added in v1.2.4

func (h *APIHandler) ListBackupDestinations(c *gin.Context)

ListBackupDestinations returns the user's configured destinations.

func (*APIHandler) ListBackupProviders added in v1.2.4

func (h *APIHandler) ListBackupProviders(c *gin.Context)

ListBackupProviders returns the static catalog of registered providers.

func (*APIHandler) ListBackupRuns added in v1.2.4

func (h *APIHandler) ListBackupRuns(c *gin.Context, destinationID generated.BackupDestinationId, params generated.ListBackupRunsParams)

ListBackupRuns returns paginated audit log entries.

func (*APIHandler) ListClassRatings

func (h *APIHandler) ListClassRatings(c *gin.Context, licenseId generated.LicenseId)

func (*APIHandler) ListContacts

func (h *APIHandler) ListContacts(c *gin.Context, params generated.ListContactsParams)

ListContacts handles GET /contacts

func (*APIHandler) ListCredentialFiles added in v1.3.2

func (h *APIHandler) ListCredentialFiles(c *gin.Context, credentialId generated.CredentialId)

ListCredentialFiles implements GET /credentials/{credentialId}/files

func (*APIHandler) ListCredentials

func (h *APIHandler) ListCredentials(c *gin.Context, params generated.ListCredentialsParams)

ListCredentials implements GET /credentials

func (*APIHandler) ListCustomCurrencyRules added in v1.3.7

func (h *APIHandler) ListCustomCurrencyRules(c *gin.Context)

ListCustomCurrencyRules implements GET /custom-currency.

func (*APIHandler) ListDeletions added in v1.3.2

func (h *APIHandler) ListDeletions(c *gin.Context, params generated.ListDeletionsParams)

ListDeletions implements GET /sync/deletions

func (*APIHandler) ListEmailDeliveries added in v1.3.2

func (h *APIHandler) ListEmailDeliveries(c *gin.Context, params generated.ListEmailDeliveriesParams)

ListEmailDeliveries implements GET /admin/email/deliveries

func (*APIHandler) ListEmailSuppressions added in v1.3.2

func (h *APIHandler) ListEmailSuppressions(c *gin.Context, params generated.ListEmailSuppressionsParams)

ListEmailSuppressions implements GET /admin/email/suppressions

func (*APIHandler) ListFlightSignatures added in v1.2.9

func (h *APIHandler) ListFlightSignatures(c *gin.Context, flightId generated.FlightId)

ListFlightSignatures implements GET /flights/{flightId}/signatures

func (*APIHandler) ListFlights

func (h *APIHandler) ListFlights(c *gin.Context, params generated.ListFlightsParams)

ListFlights implements GET /flights (GET /flights)

func (*APIHandler) ListImportTemplates added in v1.3.5

func (h *APIHandler) ListImportTemplates(c *gin.Context)

ListImportTemplates implements GET /imports/templates

func (*APIHandler) ListImports

func (h *APIHandler) ListImports(c *gin.Context, params generated.ListImportsParams)

ListImports implements GET /imports

func (*APIHandler) ListLicenseFiles added in v1.3.2

func (h *APIHandler) ListLicenseFiles(c *gin.Context, licenseId generated.LicenseId)

ListLicenseFiles implements GET /licenses/{licenseId}/files

func (*APIHandler) ListLicenses

func (h *APIHandler) ListLicenses(c *gin.Context, params generated.ListLicensesParams)

ListLicenses implements GET /licenses (GET /licenses)

func (*APIHandler) ListSessions added in v1.3.6

func (h *APIHandler) ListSessions(c *gin.Context)

ListSessions implements GET /auth/sessions (GET /auth/sessions)

func (*APIHandler) ListWebauthnCredentials added in v1.2.0

func (h *APIHandler) ListWebauthnCredentials(c *gin.Context)

ListWebauthnCredentials implements GET /auth/webauthn/credentials

func (*APIHandler) Login2FA

func (h *APIHandler) Login2FA(c *gin.Context)

Login2FA implements POST /auth/2fa/login

func (*APIHandler) LoginUser

func (h *APIHandler) LoginUser(c *gin.Context)

LoginUser implements POST /auth/login (POST /auth/login)

func (*APIHandler) LogoutUser added in v1.3.1

func (h *APIHandler) LogoutUser(c *gin.Context)

LogoutUser implements POST /auth/logout. It revokes the presented refresh token server-side and always answers 204; revocation is idempotent.

func (*APIHandler) OIDCEnabled added in v1.3.2

func (h *APIHandler) OIDCEnabled() bool

OIDCEnabled reports whether the server runs in OIDC mode.

func (*APIHandler) OidcCallback added in v1.3.7

func (h *APIHandler) OidcCallback(c *gin.Context, params generated.OidcCallbackParams)

OidcCallback implements GET /auth/oidc/callback.

The provider sends the browser here. Every failure ends in a redirect back to the frontend carrying a short error code, not a JSON error page.

func (*APIHandler) PreviewCustomCurrencyRule added in v1.3.7

func (h *APIHandler) PreviewCustomCurrencyRule(c *gin.Context)

PreviewCustomCurrencyRule implements POST /custom-currency/preview.

func (*APIHandler) PreviewImport

func (h *APIHandler) PreviewImport(c *gin.Context)

PreviewImport implements POST /imports/preview

func (*APIHandler) PutMyBaseline added in v1.2.3

func (h *APIHandler) PutMyBaseline(c *gin.Context)

PutMyBaseline implements PUT /users/me/baseline.

func (*APIHandler) RecalculateFlights

func (h *APIHandler) RecalculateFlights(c *gin.Context)

RecalculateFlights recalculates all auto-computed fields for every flight

func (*APIHandler) RecordFlightSessionEvent added in v1.2.8

func (h *APIHandler) RecordFlightSessionEvent(c *gin.Context)

RecordFlightSessionEvent implements POST /flight-sessions/current/events (POST /flight-sessions/current/events)

func (*APIHandler) RefreshToken

func (h *APIHandler) RefreshToken(c *gin.Context)

RefreshToken implements POST /auth/refresh (POST /auth/refresh)

func (*APIHandler) RegisterUser

func (h *APIHandler) RegisterUser(c *gin.Context)

RegisterUser implements POST /auth/register (POST /auth/register)

func (*APIHandler) RequestPasswordReset added in v1.1.0

func (h *APIHandler) RequestPasswordReset(c *gin.Context)

RequestPasswordReset implements POST /auth/password-reset-request (POST /auth/password-reset-request)

func (*APIHandler) ResendSignatureRequest added in v1.2.9

func (h *APIHandler) ResendSignatureRequest(c *gin.Context, flightId generated.FlightId, signatureId generated.SignatureId)

ResendSignatureRequest implements POST /flights/{flightId}/signatures/{signatureId}/resend

func (*APIHandler) ResendVerificationEmail added in v1.2.5

func (h *APIHandler) ResendVerificationEmail(c *gin.Context)

ResendVerificationEmail implements POST /auth/verify-email/resend (POST /auth/verify-email/resend)

func (*APIHandler) ResetPassword added in v1.1.0

func (h *APIHandler) ResetPassword(c *gin.Context)

ResetPassword implements POST /auth/password-reset (POST /auth/password-reset)

A reset does not disable 2FA: an account with 2FA enabled must supply a TOTP or recovery code alongside the reset token. Either way the owner is told by mail that their password changed.

func (*APIHandler) ResetUser2fa

func (h *APIHandler) ResetUser2fa(c *gin.Context, userId openapi_types.UUID)

ResetUser2fa implements POST /admin/users/{userId}/reset-2fa

func (*APIHandler) RevokeOtherSessions added in v1.3.6

func (h *APIHandler) RevokeOtherSessions(c *gin.Context)

RevokeOtherSessions implements DELETE /auth/sessions (DELETE /auth/sessions)

func (*APIHandler) RevokeSession added in v1.3.6

func (h *APIHandler) RevokeSession(c *gin.Context, sessionId openapi_types.UUID)

RevokeSession implements DELETE /auth/sessions/{sessionId} (DELETE /auth/sessions/{sessionId})

func (*APIHandler) RevokeSignatureRequest added in v1.2.9

func (h *APIHandler) RevokeSignatureRequest(c *gin.Context, flightId generated.FlightId, signatureId generated.SignatureId)

RevokeSignatureRequest implements POST /flights/{flightId}/signatures/{signatureId}/revoke

func (*APIHandler) RunBackupNow added in v1.2.4

func (h *APIHandler) RunBackupNow(c *gin.Context, destinationID generated.BackupDestinationId)

RunBackupNow starts a synchronous backup run.

func (*APIHandler) SearchAirports

func (h *APIHandler) SearchAirports(c *gin.Context, params generated.SearchAirportsParams)

SearchAirports implements GET /airports/search

func (*APIHandler) SearchContacts

func (h *APIHandler) SearchContacts(c *gin.Context, params generated.SearchContactsParams)

SearchContacts handles GET /contacts/search

func (*APIHandler) SetAdminRepository added in v1.3.4

func (h *APIHandler) SetAdminRepository(repo repository.AdminRepository)

SetAdminRepository stores the repository behind the admin console (stats, audit log, user listing, maintenance sweeps).

func (*APIHandler) SetAnnouncementRepository added in v1.3.4

func (h *APIHandler) SetAnnouncementRepository(repo repository.AnnouncementRepository)

SetAnnouncementRepository stores the system announcement repository.

func (*APIHandler) SetBackupService added in v1.2.4

func (h *APIHandler) SetBackupService(s *cloudbackup.Service)

SetBackupService stores the cloud backup service (optional — only set when BACKUP_CREDENTIALS_KEY is configured at startup).

func (*APIHandler) SetCORSOrigins

func (h *APIHandler) SetCORSOrigins(origins []string)

SetCORSOrigins stores the configured CORS origins for the config endpoint

func (*APIHandler) SetCustomCurrencyRuleEnabled added in v1.3.7

func (h *APIHandler) SetCustomCurrencyRuleEnabled(c *gin.Context, ruleID generated.CustomCurrencyRuleId)

SetCustomCurrencyRuleEnabled implements PUT /custom-currency/{ruleId}/enabled — pause or resume a rule.

func (*APIHandler) SetCustomCurrencyRuleNotify added in v1.3.7

func (h *APIHandler) SetCustomCurrencyRuleNotify(c *gin.Context, ruleID generated.CustomCurrencyRuleId)

SetCustomCurrencyRuleNotify implements PUT /custom-currency/{ruleId}/notify — opt a rule in/out of expiry notifications.

func (*APIHandler) SetCustomCurrencyService added in v1.3.7

func (h *APIHandler) SetCustomCurrencyService(s *currency.CustomService)

SetCustomCurrencyService wires the user-authored currency rule service.

func (*APIHandler) SetDeletionService added in v1.3.2

func (h *APIHandler) SetDeletionService(s *service.DeletionService)

SetDeletionService stores the tombstone feed service.

func (*APIHandler) SetDocumentFileService added in v1.3.2

func (h *APIHandler) SetDocumentFileService(s *service.DocumentFileService)

SetDocumentFileService wires up the licence/credential image subsystem.

func (*APIHandler) SetEmailDeliveryService added in v1.3.2

func (h *APIHandler) SetEmailDeliveryService(s *service.EmailDeliveryService)

SetEmailDeliveryService stores the email delivery log service.

func (*APIHandler) SetEmailSender

func (h *APIHandler) SetEmailSender(sender *email.Sender)

SetEmailSender stores the email sender for admin SMTP test

func (*APIHandler) SetFlightImportRepository added in v1.3.4

func (h *APIHandler) SetFlightImportRepository(repo repository.FlightImportRepository)

SetFlightImportRepository stores the import-history repository.

func (*APIHandler) SetFlightSessionService added in v1.2.8

func (h *APIHandler) SetFlightSessionService(s *service.FlightSessionService)

SetFlightSessionService stores the tap-to-log flight session service

func (*APIHandler) SetFlightSignatureService added in v1.2.9

func (h *APIHandler) SetFlightSignatureService(s *service.FlightSignatureService)

SetFlightSignatureService stores the instructor sign-off service

func (*APIHandler) SetOIDCService added in v1.3.2

func (h *APIHandler) SetOIDCService(s *service.OIDCService)

SetOIDCService stores the OIDC service (optional — only set when OIDC_ISSUER is configured). A non-nil service also disables every local credential endpoint; see requireLocalAuth.

func (*APIHandler) SetReportsRepository added in v1.3.4

func (h *APIHandler) SetReportsRepository(repo repository.ReportsRepository)

SetReportsRepository stores the reports/analytics read repository.

func (*APIHandler) SetStartedAt

func (h *APIHandler) SetStartedAt(t time.Time)

SetStartedAt records the server start time for uptime calculation

func (*APIHandler) SetUnverifiedAccountService added in v1.3.2

func (h *APIHandler) SetUnverifiedAccountService(s *service.UnverifiedAccountService)

SetUnverifiedAccountService stores the unverified-account reaper, so an administrator can run a sweep on demand.

func (*APIHandler) SetUpdateChecker added in v1.3.5

func (h *APIHandler) SetUpdateChecker(c *updatecheck.Checker)

SetUpdateChecker attaches the release checker.

func (*APIHandler) SetUserContentRepository added in v1.3.4

func (h *APIHandler) SetUserContentRepository(repo repository.UserContentRepository)

SetUserContentRepository stores the account-content wipe repository.

func (*APIHandler) Setup2FA

func (h *APIHandler) Setup2FA(c *gin.Context)

Setup2FA implements POST /auth/2fa/setup

func (*APIHandler) SignFlightLive added in v1.2.9

func (h *APIHandler) SignFlightLive(c *gin.Context, flightId generated.FlightId)

SignFlightLive implements POST /flights/{flightId}/signatures/live

func (*APIHandler) SmtpTest

func (h *APIHandler) SmtpTest(c *gin.Context)

SmtpTest implements POST /admin/maintenance/smtp-test

func (*APIHandler) TestBackupDestination added in v1.2.4

func (h *APIHandler) TestBackupDestination(c *gin.Context, destinationID generated.BackupDestinationId)

TestBackupDestination re-runs the provider validation.

func (*APIHandler) TriggerNotifications

func (h *APIHandler) TriggerNotifications(c *gin.Context)

TriggerNotifications implements POST /admin/maintenance/trigger-notifications

func (*APIHandler) UnlockUser

func (h *APIHandler) UnlockUser(c *gin.Context, userId openapi_types.UUID)

UnlockUser implements POST /admin/users/{userId}/unlock

func (*APIHandler) UpdateAircraft

func (h *APIHandler) UpdateAircraft(c *gin.Context, aircraftId generated.AircraftId)

UpdateAircraft implements PATCH /aircraft/{aircraftId} (PATCH /aircraft/{aircraftId})

func (*APIHandler) UpdateBackupDestination added in v1.2.4

func (h *APIHandler) UpdateBackupDestination(c *gin.Context, destinationID generated.BackupDestinationId)

UpdateBackupDestination applies a partial update.

func (*APIHandler) UpdateClassRating

func (h *APIHandler) UpdateClassRating(c *gin.Context, licenseId generated.LicenseId, ratingId openapi_types.UUID)

func (*APIHandler) UpdateContact

func (h *APIHandler) UpdateContact(c *gin.Context, contactId openapi_types.UUID)

UpdateContact handles PUT /contacts/{contactId}

func (*APIHandler) UpdateCredential

func (h *APIHandler) UpdateCredential(c *gin.Context, credentialId generated.CredentialId)

UpdateCredential implements PATCH /credentials/{credentialId}

func (*APIHandler) UpdateCurrentUser

func (h *APIHandler) UpdateCurrentUser(c *gin.Context)

UpdateCurrentUser implements PATCH /users/me (PATCH /users/me)

func (*APIHandler) UpdateCustomCurrencyRule added in v1.3.7

func (h *APIHandler) UpdateCustomCurrencyRule(c *gin.Context, ruleID generated.CustomCurrencyRuleId)

UpdateCustomCurrencyRule implements PUT /custom-currency/{ruleId}.

func (*APIHandler) UpdateFlight

func (h *APIHandler) UpdateFlight(c *gin.Context, flightId generated.FlightId)

UpdateFlight implements PUT /flights/{flightId} (PUT /flights/{flightId})

func (*APIHandler) UpdateLicense

func (h *APIHandler) UpdateLicense(c *gin.Context, licenseId generated.LicenseId)

UpdateLicense implements PATCH /licenses/{licenseId} (PATCH /licenses/{licenseId})

func (*APIHandler) UpdateNotificationPreferences

func (h *APIHandler) UpdateNotificationPreferences(c *gin.Context)

UpdateNotificationPreferences implements PATCH /users/me/notifications

func (*APIHandler) UploadCredentialFile added in v1.3.2

func (h *APIHandler) UploadCredentialFile(c *gin.Context, credentialId generated.CredentialId)

UploadCredentialFile implements POST /credentials/{credentialId}/files

func (*APIHandler) UploadImportFile

func (h *APIHandler) UploadImportFile(c *gin.Context)

UploadImportFile implements POST /imports/upload

func (*APIHandler) UploadLicenseFile added in v1.3.2

func (h *APIHandler) UploadLicenseFile(c *gin.Context, licenseId generated.LicenseId)

UploadLicenseFile implements POST /licenses/{licenseId}/files

func (*APIHandler) Verify2FA

func (h *APIHandler) Verify2FA(c *gin.Context)

Verify2FA implements POST /auth/2fa/verify

func (*APIHandler) VerifyEmail added in v1.2.5

func (h *APIHandler) VerifyEmail(c *gin.Context)

VerifyEmail implements POST /auth/verify-email (POST /auth/verify-email)

func (*APIHandler) VoidFlightSignature added in v1.2.9

func (h *APIHandler) VoidFlightSignature(c *gin.Context, flightId generated.FlightId, signatureId generated.SignatureId)

VoidFlightSignature implements POST /flights/{flightId}/signatures/{signatureId}/void

func (*APIHandler) WebauthnLoginOptions added in v1.2.0

func (h *APIHandler) WebauthnLoginOptions(c *gin.Context)

WebauthnLoginOptions implements POST /auth/webauthn/login/options

func (*APIHandler) WebauthnLoginVerify added in v1.2.0

func (h *APIHandler) WebauthnLoginVerify(c *gin.Context)

WebauthnLoginVerify implements POST /auth/webauthn/login/verify

func (*APIHandler) WebauthnRegisterOptions added in v1.2.0

func (h *APIHandler) WebauthnRegisterOptions(c *gin.Context)

WebauthnRegisterOptions implements POST /auth/webauthn/register/options

func (*APIHandler) WebauthnRegisterVerify added in v1.2.0

func (h *APIHandler) WebauthnRegisterVerify(c *gin.Context)

WebauthnRegisterVerify implements POST /auth/webauthn/register/verify

type AircraftBreakdown

type AircraftBreakdown struct {
	AircraftType string `json:"aircraftType"`
	TotalFlights int    `json:"totalFlights"`
	TotalMinutes int    `json:"totalMinutes"`
}

AircraftBreakdown represents flight statistics per aircraft type

type MonthlyTrend

type MonthlyTrend struct {
	Month         string `json:"month"`
	TotalFlights  int    `json:"totalFlights"`
	TotalMinutes  int    `json:"totalMinutes"`
	PICMinutes    int    `json:"picMinutes"`
	DualMinutes   int    `json:"dualMinutes"`
	NightMinutes  int    `json:"nightMinutes"`
	IFRMinutes    int    `json:"ifrMinutes"`
	LandingsDay   int    `json:"landingsDay"`
	LandingsNight int    `json:"landingsNight"`
}

MonthlyTrend represents flight statistics for a single month

type TrendsResponse

type TrendsResponse struct {
	Monthly        []MonthlyTrend      `json:"monthly"`
	ByAircraftType []AircraftBreakdown `json:"byAircraftType"`
}

TrendsResponse contains all reporting data

Jump to

Keyboard shortcuts

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