-
Declaration
Swift
func registerRoutes(_ app: Application) throws
-
categoryIDParam
Extension methodDeclaration
Swift
var categoryIDParam: PathComponent { get }
-
twarrtIDParam
Extension methodDeclaration
Swift
var twarrtIDParam: PathComponent { get }
-
forumIDParam
Extension methodDeclaration
Swift
var forumIDParam: PathComponent { get }
-
postIDParam
Extension methodDeclaration
Swift
var postIDParam: PathComponent { get }
-
fezIDParam
Extension methodDeclaration
Swift
var fezIDParam: PathComponent { get }
-
fezPostIDParam
Extension methodDeclaration
Swift
var fezPostIDParam: PathComponent { get }
-
userIDParam
Extension methodDeclaration
Swift
var userIDParam: PathComponent { get }
-
eventIDParam
Extension methodDeclaration
Swift
var eventIDParam: PathComponent { get }
-
reportIDParam
Extension methodDeclaration
Swift
var reportIDParam: PathComponent { get }
-
modStateParam
Extension methodDeclaration
Swift
var modStateParam: PathComponent { get }
-
announcementIDParam
Extension methodDeclaration
Swift
var announcementIDParam: PathComponent { get }
-
alertwordParam
Extension methodDeclaration
Swift
var alertwordParam: PathComponent { get }
-
mutewordParam
Extension methodDeclaration
Swift
var mutewordParam: PathComponent { get }
-
searchStringParam
Extension methodDeclaration
Swift
var searchStringParam: PathComponent { get }
-
dailyThemeIDParam
Extension methodDeclaration
Swift
var dailyThemeIDParam: PathComponent { get }
-
accessLevelParam
Extension methodDeclaration
Swift
var accessLevelParam: PathComponent { get }
-
boardgameIDParam
Extension methodDeclaration
Swift
var boardgameIDParam: PathComponent { get }
-
songIDParam
Extension methodDeclaration
Swift
var songIDParam: PathComponent { get }
-
mkSongIDParam
Extension methodDeclaration
Swift
var mkSongIDParam: PathComponent { get }
-
mkSnippetIDParam
Extension methodDeclaration
Swift
var mkSnippetIDParam: PathComponent { get }
-
userRoleParam
Extension methodDeclaration
Swift
var userRoleParam: PathComponent { get }
-
phonecallParam
Extension methodDeclaration
Swift
var phonecallParam: PathComponent { get }
-
scheduleLogIDParam
Extension methodDeclaration
Swift
var scheduleLogIDParam: PathComponent { get }
-
filenameParam
Extension methodDeclaration
Swift
var filenameParam: PathComponent { get }
-
dateFromParameter(string:
Extension method) Transforms a string that might represent a date (either a
Double
or an ISO 8601 representation) into aDate
, if possible.Note
The representation is expected to be either a string literal
Double
, or a string in UTCyyyy-MM-dd'T'HH:mm:ssZ
format.Declaration
Swift
static func dateFromParameter(string: String) -> Date?
Parameters
string
The string to be transformed.
Return Value
A
Date
if the conversion was successful, otherwisenil
.
-
addFlexAuthGroup(to:
Extension method) Adds Flexible Auth to a route. This route can be accessed without a token (while not logged in), but
req.auth.get(User.self)
will still return a user if one is logged in. Route handlers for these routes should not callreq.auth.require(User.self)
. A route with no auth middleware will not auth any user and.get(User.self)
will always return nil. The Basic and Token auth groups will throw an error if no user gets authenticated (specifically:User.guardMiddleware
throws).So, use this auth group for routes that can be accessed while not logged in, but which provide more (or different) data when a logged-in user accesses the route.
Declaration
Swift
func addFlexAuthGroup(to: RoutesBuilder) -> RoutesBuilder
-
addFlexCacheAuthGroup(to:
Extension method) I’m moving auth over to UserCache, so that you’ll auth a UserCacheData struct instead of a User model. Functionally, this means a
UserCacheData
gets added toreq.auth
instead of aUser
. And, we avoid a SQL call per API call.Declaration
Swift
func addFlexCacheAuthGroup(to: RoutesBuilder) -> RoutesBuilder
-
addBasicAuthGroup(to:
Extension method) For routes that require HTTP Basic Auth. Tokens won’t work. Generally, this is only for the login route.
Declaration
Swift
func addBasicAuthGroup(to: RoutesBuilder) -> RoutesBuilder
-
addTokenCacheAuthGroup(to:
Extension method) For routes that require a logged-in user. Applying this auth group to a route will make requests that don’t have a valid token fail with a HTTP 401 error.
Declaration
Swift
func addTokenCacheAuthGroup(to: RoutesBuilder) -> RoutesBuilder
-
guardNotSpecialAccount(_:
Extension method) Declaration
Swift
func guardNotSpecialAccount(_ targetUser: User) throws
-
addNotifications(users:
Extension method, asynchronoustype: info: on: ) Declaration
Swift
func addNotifications(users: [UUID], type: NotificationType, info: String, on req: Request) async throws
-
handleUnreadMessage(req:
Extension methodmsgID: inbox: users: group: ) Declaration
Swift
func handleUnreadMessage( req: Request, msgID: UUID, inbox: Request.Redis.MailInbox, users: [UUID], group: inout ThrowingTaskGroup<Void, Error> ) -> [UUID]
-
subtractNotifications(users:
Extension method, asynchronoustype: subtractCount: on: ) Declaration
Swift
func subtractNotifications(users: [UUID], type: NotificationType, subtractCount: Int = 1, on req: Request) async throws
-
deleteFezNotifications(userIDs:
Extension method, asynchronousfez: on: ) Declaration
Swift
func deleteFezNotifications(userIDs: [UUID], fez: FriendlyFez, on req: Request) async throws
-
markNotificationViewed(user:
Extension method, asynchronoustype: on: ) Declaration
Swift
func markNotificationViewed(user: UserCacheData, type: NotificationType, on req: Request) async throws
-
storeNextFollowedEvent(userID:
Extension method, asynchronouson: ) Declaration
Swift
func storeNextFollowedEvent(userID: UUID, on req: Request) async throws -> (Date, UUID)?
-
storeNextJoinedLFG(userID:
Extension method, asynchronouson: ) Declaration
Swift
func storeNextJoinedLFG(userID: UUID, on req: Request) async throws -> (Date, UUID)?
-
getImagePath(for:
Extension methodformat: usage: size: on: ) Returns the file system path for the given image filename. Makes sure all image directories in the path exist.
Currently, this fn returns paths in the form:
/images/ / / .jpg where “xx” is the first 2 characters of the filename. Declaration
Swift
func getImagePath(for image: String, format: String? = nil, usage: ImageUsage, size: ImageSizeGroup, on req: Request) throws -> URL
-
processImages(_:
Extension method, asynchronoususage: on: ) Takes an an array of
ImageUploadData
as input. Some of the input elements may be new image Data that needs procssing; some of the input elements may refer to already-processed images in our image store. Once all the ImageUploadData elements are processed, returns a[String]
containing the filenames where al the images are stored. The use case here is for editing existing content with image attachments in a way that prevents re-uploading of photos that are already on the server.- req: The incoming
Request
, on which this processing must run.
Declaration
Swift
func processImages(_ images: [ImageUploadData], usage: ImageUsage, on req: Request) async throws -> [String]
Parameters
images
The images in
ImageUploadData
format.usage
The type of model using the image content.
Return Value
The generated names of the stored files.
- req: The incoming
-
processImage(data:
Extension method, asynchronoususage: on: ) Takes an optional image in Data form as input, produces full and thumbnail JPEG vrsions, places both the thumbnail and full image in their respective directories, and returns the generated name of the file on success, an empty string otherwise.
- req: The incoming
Request
, on which this processing must run.
Declaration
Swift
func processImage(data: Data?, usage: ImageUsage, on req: Request) async throws -> String?
Parameters
data
The uploaded image in
Data
format.usage
The type of model using the image content.
Return Value
The generated name of the stored file, or nil.
- req: The incoming
-
archiveImage(_:
Extension methodon: ) Archives an image that is no longer needed other than for accountability tracking, by removing the full-sized image and moving the thumbnail into the
archive/
subdirectory of the provided base image directory.This is a synchronous operation, until such time as we can use SwiftNIO 2’s asynchronous file I/O.
Declaration
Swift
func archiveImage(_ image: String, on req: Request)
Parameters
image
The filename of the image.
imageDir
The base image directory path for the image’s context.