ReadAll
public final class ReadAll<T> : ReadEndpoint where T : CorvusModel
A class that provides functionality to read all objects of a generic type
T conforming to CorvusModel.
-
The return type of the
.query().Declaration
Swift
public typealias QuerySubject = T -
The return type of the
.handler().Declaration
Swift
public typealias Element = [T] -
A property that describes if only existing, only trashed or both objects should be read from the database.
Declaration
Swift
public let target: ReadTarget<QuerySubject> -
The default
operationTypeis GET.Declaration
Swift
public var operationType: OperationType { get } -
Initializes the component
Declaration
Swift
public init(_ target: ReadTarget<QuerySubject> = .existing)Parameters
targetA
ReadTargetwhich controls where to query the item from. -
A method to return all objects of the type
QuerySubjectfrom the database, depending on thetarget.Throws
AnAborterror if something goes wrong.Declaration
Swift
public func handler(_ req: Request) throws -> EventLoopFuture<Element>Parameters
reqAn incoming
Request.Return Value
An array of
QuerySubjects. -
A modifier used to make sure components only authorize requests where the supplied user
Uis actually related to theQuerySubject.Declaration
Swift
public func auth<I: CorvusModel, U: CorvusModelAuthenticatable> ( _ intermediate: NestedReadAllAuthModifier<ReadAll, I, U> .IntermediateKeyPath, _ user: NestedReadAllAuthModifier<ReadAll, I, U>.UserKeyPath ) -> NestedReadAllAuthModifier<ReadAll, I, U>Parameters
intermediateA
KeyPathto the intermediate property.userA
KeyPathto the related user property from the intermediate.Return Value
An instance of a
AuthModifierwith the suppliedKeyPathto the user. -
A modifier used to make sure components only authorize requests where the supplied user
Uis actually related to theQuerySubject.Declaration
Swift
public func auth<U: CorvusModelAuthenticatable> ( _ user: ReadAllAuthModifier<ReadAll, U>.UserKeyPath ) -> ReadAllAuthModifier<ReadAll, U>Parameters
userA
KeyPathto the related user property from the intermediate.Return Value
An instance of a
AuthModifierwith the suppliedKeyPathto the user.
ReadAll Class Reference