chore: move identity entity in its own folder

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-08-08 21:53:20 +02:00 committed by David Mehren
parent 547f2239cc
commit 23e26fb830
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
19 changed files with 129 additions and 73 deletions

View file

@ -1,56 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import {
Column,
CreateDateColumn,
Entity,
ManyToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { User } from './user.entity';
@Entity()
export class Identity {
@PrimaryGeneratedColumn()
id: number;
@ManyToOne((_) => User, (user) => user.identities, {
onDelete: 'CASCADE', // This deletes the Identity, when the associated User is deleted
})
user: User;
@Column()
providerName: string;
@Column()
syncSource: boolean;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
@Column({
nullable: true,
type: 'text',
})
providerUserId: string | null;
@Column({
nullable: true,
type: 'text',
})
oAuthAccessToken: string | null;
@Column({
nullable: true,
type: 'text',
})
passwordHash: string | null;
}

View file

@ -17,9 +17,9 @@ import { AuthToken } from '../auth/auth-token.entity';
import { Author } from '../authors/author.entity';
import { Group } from '../groups/group.entity';
import { HistoryEntry } from '../history/history-entry.entity';
import { Identity } from '../identity/identity.entity';
import { MediaUpload } from '../media/media-upload.entity';
import { Note } from '../notes/note.entity';
import { Identity } from './identity.entity';
@Entity()
export class User {

View file

@ -6,8 +6,8 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Identity } from '../identity/identity.entity';
import { LoggerModule } from '../logger/logger.module';
import { Identity } from './identity.entity';
import { Session } from './session.entity';
import { User } from './user.entity';
import { UsersService } from './users.service';