SiteDailyReportController

struct SiteDailyReportController : SiteControllerUtils

Site pages for the daily report to JoCo Cruise Operations, under Server Settings (/admin/dailyreport). TwitarrTeam and above. The data and rules live in DailyReportController; these routes call its API.

Time handling

  • datetime-local inputs have no time zone, so they’re read and written in ship time.

    Declaration

    Swift

    private static func formatter() -> DateFormatter
  • Declaration

    Swift

    private static func parse(_ string: String?) throws -> Date?
  • The configured daily report cutoff as a clock time, e.g. “5:00 PM”.

    Declaration

    Swift

    private static func cutoffText() -> String

Pages

  • listPage(_:) Asynchronous

    GET /admin/dailyreport

    The list of reports, with a form to start a new one.

    See more

    Declaration

    Swift

    func listPage(_ req: Request) async throws -> View
  • editPage(_:) Asynchronous

    GET /admin/dailyreport/:daily_report_id

    The editor: one box per line of the contract, with Save, Regenerate, Finalize, Print and Download.

    See more

    Declaration

    Swift

    func editPage(_ req: Request) async throws -> View

Actions

  • createPost(_:) Asynchronous

    POST /admin/dailyreport/create

    Drafts a report, then sends the user to its editor.

    Declaration

    Swift

    func createPost(_ req: Request) async throws -> Response
  • updatePost(_:) Asynchronous

    POST /admin/dailyreport/:daily_report_id/update

    Declaration

    Swift

    func updatePost(_ req: Request) async throws -> HTTPStatus
  • regeneratePost(_:) Asynchronous

    POST /admin/dailyreport/:daily_report_id/regenerate

    Declaration

    Swift

    func regeneratePost(_ req: Request) async throws -> HTTPStatus
  • finalizePost(_:) Asynchronous

    POST /admin/dailyreport/:daily_report_id/finalize

    Declaration

    Swift

    func finalizePost(_ req: Request) async throws -> HTTPStatus
  • reopenPost(_:) Asynchronous

    POST /admin/dailyreport/:daily_report_id/reopen

    Declaration

    Swift

    func reopenPost(_ req: Request) async throws -> HTTPStatus
  • setStatus(_:_:) Asynchronous

    Declaration

    Swift

    private func setStatus(_ status: DailyReportStatus, _ req: Request) async throws -> HTTPStatus
  • deletePost(_:) Asynchronous

    POST /admin/dailyreport/:daily_report_id/delete

    Declaration

    Swift

    func deletePost(_ req: Request) async throws -> HTTPStatus
  • htmlExport(_:) Asynchronous

    GET /admin/dailyreport/:daily_report_id/print GET /admin/dailyreport/:daily_report_id/download

    The standalone HTML document from the API: print shows it in the browser (print it to PDF from there), download sends it as a file.

    Declaration

    Swift

    func htmlExport(_ req: Request) async throws -> Response
  • Declaration

    Swift

    private func reportID(_ req: Request) throws -> UUID