Structure
UsersUseCase
public struct UsersUseCase: UseCase
Use cases for Users.
Initializers
Methods
login(form:)
public func login( form: LoginUser ) -> Future<UserResponse>
This use case has work of user login.
Parameters
Name | Type | Description |
---|---|---|
form | LoginUser |
Please pass the information used for authentication with |
Returns
The Future
that returns UserResponse
.
register(user:)
public func register(user form: NewUser ) throws -> Future<UserResponse>
This use case has work of user registration.
Parameters
Name | Type | Description |
---|---|---|
form | NewUser |
Please pass the information used for user registration with |
Throws
See JWTWithVaporRepository.issueJWT(id:username:)
.
Returns
The Future
that returns UserResponse
.
update(userId:token:updateUser:)
public func update(userId: Int, token: String, updateUser user: UpdateUser ) -> Future<UserResponse>
This use case has work of User
updating.
Parameters
Name | Type | Description |
---|---|---|
userId | Int |
Please pass the id of the user to be updated. |
token | String |
Please pass the authenticated JWT used for this session. |
user | UpdateUser |
Please pass the information used for user updating with |
Returns
The Future
that returns UserResponse
.