March 2020
Intermediate to advanced
392 pages
10h 10m
English
One typical model that almost every application encounters is the Login model. It holds all the data a user enters when logging in, for example, an email and password. In its more primitive form, it would look like the following:
struct LoginInput: Content { let email: String let password: String}
When the user has logged in successfully, you will want to return some of the user information and then access and refresh the tokens. Notice that, here, you already wish for a different model than the user DB model itself, because you don't want to return the password hash.
So, the returning I/O model would look like this:
struct LoginOutput: Content { let userId: Int let email: String let firstname: String? let lastname: String? let ...Read now
Unlock full access