private: adds tokens controller

adds private api
adds AuthTokenDto and AuthTokenWithSecretDto
adds necessary methods in the users service
adds RandomnessError

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-16 23:53:46 +01:00
parent b586b9ffb2
commit cbf6ac912a
10 changed files with 248 additions and 12 deletions

View file

@ -10,7 +10,7 @@ import {
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { Column, OneToMany } from 'typeorm/index';
import { Column, OneToMany } from 'typeorm';
import { Note } from '../notes/note.entity';
import { AuthToken } from './auth-token.entity';
import { Identity } from './identity.entity';
@ -46,7 +46,7 @@ export class User {
ownedNotes: Note[];
@OneToMany((_) => AuthToken, (authToken) => authToken.user)
authToken: AuthToken[];
authTokens: AuthToken[];
@OneToMany((_) => Identity, (identity) => identity.user)
identities: Identity[];
@ -59,7 +59,7 @@ export class User {
displayName: string,
): Pick<
User,
'userName' | 'displayName' | 'ownedNotes' | 'authToken' | 'identities'
'userName' | 'displayName' | 'ownedNotes' | 'authTokens' | 'identities'
> {
const newUser = new User();
newUser.userName = userName;