Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
automatic UserIDType extension where model, fixes #41
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed May 15, 2018
1 parent 2eacbf5 commit b84242e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Authentication/Token/TokenAuthenticatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public protocol Token: BearerAuthenticatable {
static var userIDKey: UserIDKey { get }
}

extension Model where Self: Token, Self.UserType: Model {
/// See `Token`.
public typealias UserIDType = UserType.ID
}

extension TokenAuthenticatable
where Self: Model, Self.TokenType: Model, Self.Database: QuerySupporting, Self.TokenType.Database == Self.Database, Self.TokenType.UserIDType == Self.ID
{
Expand Down

0 comments on commit b84242e

Please sign in to comment.