From f362d27d3f3a10fd1ee28d5d5adab4a09f6682c0 Mon Sep 17 00:00:00 2001 From: Yannick Bungers Date: Sun, 25 Jun 2023 21:52:44 +0200 Subject: [PATCH] Move session entity to sessions folder Signed-off-by: Yannick Bungers --- backend/src/api/private/auth/auth.controller.ts | 2 +- backend/src/api/utils/request.type.ts | 2 +- backend/src/app-init.ts | 2 +- backend/src/app.module.ts | 2 +- backend/src/auth/auth.service.spec.ts | 2 +- backend/src/authors/author.entity.ts | 2 +- backend/src/history/history.service.spec.ts | 2 +- backend/src/media/media.service.spec.ts | 2 +- backend/src/notes/alias.service.spec.ts | 2 +- backend/src/notes/notes.service.spec.ts | 2 +- backend/src/permissions/permissions.service.spec.ts | 2 +- backend/src/realtime/realtime-note/realtime-note.module.ts | 2 +- backend/src/realtime/websocket/websocket.gateway.spec.ts | 6 +++--- backend/src/realtime/websocket/websocket.gateway.ts | 2 +- backend/src/realtime/websocket/websocket.module.ts | 2 +- backend/src/revisions/revisions.service.spec.ts | 2 +- backend/src/seed.ts | 2 +- backend/src/{users => sessions}/session.entity.ts | 0 backend/src/{session => sessions}/session.module.ts | 2 +- backend/src/{session => sessions}/session.service.spec.ts | 2 +- backend/src/{session => sessions}/session.service.ts | 2 +- backend/src/users/users.module.ts | 4 ++-- backend/test/test-setup.ts | 4 ++-- 23 files changed, 26 insertions(+), 26 deletions(-) rename backend/src/{users => sessions}/session.entity.ts (100%) rename backend/src/{session => sessions}/session.module.ts (89%) rename backend/src/{session => sessions}/session.service.spec.ts (99%) rename backend/src/{session => sessions}/session.service.ts (98%) diff --git a/backend/src/api/private/auth/auth.controller.ts b/backend/src/api/private/auth/auth.controller.ts index 36055e08c..7fe1b293e 100644 --- a/backend/src/api/private/auth/auth.controller.ts +++ b/backend/src/api/private/auth/auth.controller.ts @@ -26,7 +26,7 @@ import { RegisterDto } from '../../../identity/local/register.dto'; import { UpdatePasswordDto } from '../../../identity/local/update-password.dto'; import { SessionGuard } from '../../../identity/session.guard'; import { ConsoleLoggerService } from '../../../logger/console-logger.service'; -import { SessionState } from '../../../session/session.service'; +import { SessionState } from '../../../sessions/session.service'; import { User } from '../../../users/user.entity'; import { UsersService } from '../../../users/users.service'; import { makeUsernameLowercase } from '../../../utils/username'; diff --git a/backend/src/api/utils/request.type.ts b/backend/src/api/utils/request.type.ts index 95054d00b..a5ecfc045 100644 --- a/backend/src/api/utils/request.type.ts +++ b/backend/src/api/utils/request.type.ts @@ -6,7 +6,7 @@ import { Request } from 'express'; import { Note } from '../../notes/note.entity'; -import { SessionState } from '../../session/session.service'; +import { SessionState } from '../../sessions/session.service'; import { User } from '../../users/user.entity'; export type CompleteRequest = Request & { diff --git a/backend/src/app-init.ts b/backend/src/app-init.ts index 85f0c2c77..27b3e5ca4 100644 --- a/backend/src/app-init.ts +++ b/backend/src/app-init.ts @@ -13,7 +13,7 @@ import { MediaConfig } from './config/media.config'; import { ErrorExceptionMapping } from './errors/error-mapping'; import { ConsoleLoggerService } from './logger/console-logger.service'; import { BackendType } from './media/backends/backend-type.enum'; -import { SessionService } from './session/session.service'; +import { SessionService } from './sessions/session.service'; import { setupSpecialGroups } from './utils/createSpecialGroups'; import { setupSessionMiddleware } from './utils/session'; import { setupValidationPipe } from './utils/setup-pipes'; diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 5b456585c..ec5a0d5b3 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -37,7 +37,7 @@ import { NotesModule } from './notes/notes.module'; import { PermissionsModule } from './permissions/permissions.module'; import { WebsocketModule } from './realtime/websocket/websocket.module'; import { RevisionsModule } from './revisions/revisions.module'; -import { SessionModule } from './session/session.module'; +import { SessionModule } from './sessions/session.module'; import { UsersModule } from './users/users.module'; const routes: Routes = [ diff --git a/backend/src/auth/auth.service.spec.ts b/backend/src/auth/auth.service.spec.ts index 26031271f..fd8aa014a 100644 --- a/backend/src/auth/auth.service.spec.ts +++ b/backend/src/auth/auth.service.spec.ts @@ -18,7 +18,7 @@ import { } from '../errors/errors'; import { Identity } from '../identity/identity.entity'; import { LoggerModule } from '../logger/logger.module'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; import { UsersModule } from '../users/users.module'; import { AuthToken } from './auth-token.entity'; diff --git a/backend/src/authors/author.entity.ts b/backend/src/authors/author.entity.ts index de46461f1..4bb5bcf0d 100644 --- a/backend/src/authors/author.entity.ts +++ b/backend/src/authors/author.entity.ts @@ -12,7 +12,7 @@ import { } from 'typeorm'; import { Edit } from '../revisions/edit.entity'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; export type AuthorColor = number; diff --git a/backend/src/history/history.service.spec.ts b/backend/src/history/history.service.spec.ts index 3e2a3765c..9988de0b6 100644 --- a/backend/src/history/history.service.spec.ts +++ b/backend/src/history/history.service.spec.ts @@ -32,7 +32,7 @@ import { Edit } from '../revisions/edit.entity'; import { Revision } from '../revisions/revision.entity'; import { RevisionsModule } from '../revisions/revisions.module'; import { RevisionsService } from '../revisions/revisions.service'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; import { UsersModule } from '../users/users.module'; import { mockSelectQueryBuilderInRepo } from '../utils/test-utils/mockSelectQueryBuilder'; diff --git a/backend/src/media/media.service.spec.ts b/backend/src/media/media.service.spec.ts index 649f650fa..ee7810cdf 100644 --- a/backend/src/media/media.service.spec.ts +++ b/backend/src/media/media.service.spec.ts @@ -30,7 +30,7 @@ import { NoteGroupPermission } from '../permissions/note-group-permission.entity import { NoteUserPermission } from '../permissions/note-user-permission.entity'; import { Edit } from '../revisions/edit.entity'; import { Revision } from '../revisions/revision.entity'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; import { UsersModule } from '../users/users.module'; import { BackendType } from './backends/backend-type.enum'; diff --git a/backend/src/notes/alias.service.spec.ts b/backend/src/notes/alias.service.spec.ts index 5dd3fe574..bf5674268 100644 --- a/backend/src/notes/alias.service.spec.ts +++ b/backend/src/notes/alias.service.spec.ts @@ -33,7 +33,7 @@ import { RealtimeNoteModule } from '../realtime/realtime-note/realtime-note.modu import { Edit } from '../revisions/edit.entity'; import { Revision } from '../revisions/revision.entity'; import { RevisionsModule } from '../revisions/revisions.module'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; import { UsersModule } from '../users/users.module'; import { mockSelectQueryBuilderInRepo } from '../utils/test-utils/mockSelectQueryBuilder'; diff --git a/backend/src/notes/notes.service.spec.ts b/backend/src/notes/notes.service.spec.ts index d56436c85..5a25eee50 100644 --- a/backend/src/notes/notes.service.spec.ts +++ b/backend/src/notes/notes.service.spec.ts @@ -45,7 +45,7 @@ import { Edit } from '../revisions/edit.entity'; import { Revision } from '../revisions/revision.entity'; import { RevisionsModule } from '../revisions/revisions.module'; import { RevisionsService } from '../revisions/revisions.service'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; import { UsersModule } from '../users/users.module'; import { mockSelectQueryBuilderInRepo } from '../utils/test-utils/mockSelectQueryBuilder'; diff --git a/backend/src/permissions/permissions.service.spec.ts b/backend/src/permissions/permissions.service.spec.ts index 83af24699..320c97b4f 100644 --- a/backend/src/permissions/permissions.service.spec.ts +++ b/backend/src/permissions/permissions.service.spec.ts @@ -40,7 +40,7 @@ import { NotesModule } from '../notes/notes.module'; import { Tag } from '../notes/tag.entity'; import { Edit } from '../revisions/edit.entity'; import { Revision } from '../revisions/revision.entity'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; import { UsersModule } from '../users/users.module'; import { NoteGroupPermission } from './note-group-permission.entity'; diff --git a/backend/src/realtime/realtime-note/realtime-note.module.ts b/backend/src/realtime/realtime-note/realtime-note.module.ts index 102c56baa..087fb2bd0 100644 --- a/backend/src/realtime/realtime-note/realtime-note.module.ts +++ b/backend/src/realtime/realtime-note/realtime-note.module.ts @@ -9,7 +9,7 @@ import { ScheduleModule } from '@nestjs/schedule'; import { LoggerModule } from '../../logger/logger.module'; import { PermissionsModule } from '../../permissions/permissions.module'; import { RevisionsModule } from '../../revisions/revisions.module'; -import { SessionModule } from '../../session/session.module'; +import { SessionModule } from '../../sessions/session.module'; import { UsersModule } from '../../users/users.module'; import { RealtimeNoteStore } from './realtime-note-store'; import { RealtimeNoteService } from './realtime-note.service'; diff --git a/backend/src/realtime/websocket/websocket.gateway.spec.ts b/backend/src/realtime/websocket/websocket.gateway.spec.ts index 1912cc958..16ff225da 100644 --- a/backend/src/realtime/websocket/websocket.gateway.spec.ts +++ b/backend/src/realtime/websocket/websocket.gateway.spec.ts @@ -35,9 +35,9 @@ import { PermissionsModule } from '../../permissions/permissions.module'; import { PermissionsService } from '../../permissions/permissions.service'; import { Edit } from '../../revisions/edit.entity'; import { Revision } from '../../revisions/revision.entity'; -import { SessionModule } from '../../session/session.module'; -import { SessionService } from '../../session/session.service'; -import { Session } from '../../users/session.entity'; +import { Session } from '../../sessions/session.entity'; +import { SessionModule } from '../../sessions/session.module'; +import { SessionService } from '../../sessions/session.service'; import { User } from '../../users/user.entity'; import { UsersModule } from '../../users/users.module'; import { UsersService } from '../../users/users.service'; diff --git a/backend/src/realtime/websocket/websocket.gateway.ts b/backend/src/realtime/websocket/websocket.gateway.ts index d92c5bf17..bbce87c1b 100644 --- a/backend/src/realtime/websocket/websocket.gateway.ts +++ b/backend/src/realtime/websocket/websocket.gateway.ts @@ -16,7 +16,7 @@ import { ConsoleLoggerService } from '../../logger/console-logger.service'; import { NotesService } from '../../notes/notes.service'; import { NotePermission } from '../../permissions/note-permission.enum'; import { PermissionsService } from '../../permissions/permissions.service'; -import { SessionService } from '../../session/session.service'; +import { SessionService } from '../../sessions/session.service'; import { User } from '../../users/user.entity'; import { UsersService } from '../../users/users.service'; import { RealtimeConnection } from '../realtime-note/realtime-connection'; diff --git a/backend/src/realtime/websocket/websocket.module.ts b/backend/src/realtime/websocket/websocket.module.ts index afec20737..83c3bff01 100644 --- a/backend/src/realtime/websocket/websocket.module.ts +++ b/backend/src/realtime/websocket/websocket.module.ts @@ -8,7 +8,7 @@ import { Module } from '@nestjs/common'; import { LoggerModule } from '../../logger/logger.module'; import { NotesModule } from '../../notes/notes.module'; import { PermissionsModule } from '../../permissions/permissions.module'; -import { SessionModule } from '../../session/session.module'; +import { SessionModule } from '../../sessions/session.module'; import { UsersModule } from '../../users/users.module'; import { RealtimeNoteModule } from '../realtime-note/realtime-note.module'; import { WebsocketGateway } from './websocket.gateway'; diff --git a/backend/src/revisions/revisions.service.spec.ts b/backend/src/revisions/revisions.service.spec.ts index 8c4dd3e2c..1b1154a44 100644 --- a/backend/src/revisions/revisions.service.spec.ts +++ b/backend/src/revisions/revisions.service.spec.ts @@ -27,7 +27,7 @@ import { NotesModule } from '../notes/notes.module'; import { Tag } from '../notes/tag.entity'; import { NoteGroupPermission } from '../permissions/note-group-permission.entity'; import { NoteUserPermission } from '../permissions/note-user-permission.entity'; -import { Session } from '../users/session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from '../users/user.entity'; import { Edit } from './edit.entity'; import { EditService } from './edit.service'; diff --git a/backend/src/seed.ts b/backend/src/seed.ts index f27f328a4..956599450 100644 --- a/backend/src/seed.ts +++ b/backend/src/seed.ts @@ -19,7 +19,7 @@ import { NoteGroupPermission } from './permissions/note-group-permission.entity' import { NoteUserPermission } from './permissions/note-user-permission.entity'; import { Edit } from './revisions/edit.entity'; import { Revision } from './revisions/revision.entity'; -import { Session } from './users/session.entity'; +import { Session } from './sessions/session.entity'; import { User } from './users/user.entity'; import { hashPassword } from './utils/password'; diff --git a/backend/src/users/session.entity.ts b/backend/src/sessions/session.entity.ts similarity index 100% rename from backend/src/users/session.entity.ts rename to backend/src/sessions/session.entity.ts diff --git a/backend/src/session/session.module.ts b/backend/src/sessions/session.module.ts similarity index 89% rename from backend/src/session/session.module.ts rename to backend/src/sessions/session.module.ts index 3044bad10..d3c20e2c2 100644 --- a/backend/src/session/session.module.ts +++ b/backend/src/sessions/session.module.ts @@ -6,7 +6,7 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { Session } from '../users/session.entity'; +import { Session } from './session.entity'; import { SessionService } from './session.service'; @Module({ diff --git a/backend/src/session/session.service.spec.ts b/backend/src/sessions/session.service.spec.ts similarity index 99% rename from backend/src/session/session.service.spec.ts rename to backend/src/sessions/session.service.spec.ts index 844178fd9..7ab2f112a 100644 --- a/backend/src/session/session.service.spec.ts +++ b/backend/src/sessions/session.service.spec.ts @@ -14,8 +14,8 @@ import { Repository } from 'typeorm'; import { AuthConfig } from '../config/auth.config'; import { DatabaseType } from '../config/database-type.enum'; import { DatabaseConfig } from '../config/database.config'; -import { Session } from '../users/session.entity'; import { HEDGEDOC_SESSION } from '../utils/session'; +import { Session } from './session.entity'; import { SessionService, SessionState } from './session.service'; jest.mock('cookie'); diff --git a/backend/src/session/session.service.ts b/backend/src/sessions/session.service.ts similarity index 98% rename from backend/src/session/session.service.ts rename to backend/src/sessions/session.service.ts index 27676ad22..828c908bb 100644 --- a/backend/src/session/session.service.ts +++ b/backend/src/sessions/session.service.ts @@ -17,9 +17,9 @@ import { DatabaseType } from '../config/database-type.enum'; import databaseConfiguration, { DatabaseConfig, } from '../config/database.config'; -import { Session } from '../users/session.entity'; import { HEDGEDOC_SESSION } from '../utils/session'; import { Username } from '../utils/username'; +import { Session } from './session.entity'; export interface SessionState { cookie: unknown; diff --git a/backend/src/users/users.module.ts b/backend/src/users/users.module.ts index 29b6d7fe5..4229214e1 100644 --- a/backend/src/users/users.module.ts +++ b/backend/src/users/users.module.ts @@ -8,12 +8,12 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { Identity } from '../identity/identity.entity'; import { LoggerModule } from '../logger/logger.module'; -import { Session } from './session.entity'; +import { Session } from '../sessions/session.entity'; import { User } from './user.entity'; import { UsersService } from './users.service'; @Module({ - imports: [TypeOrmModule.forFeature([User, Identity, Session]), LoggerModule], + imports: [TypeOrmModule.forFeature([User, Identity]), LoggerModule, Session], providers: [UsersService], exports: [UsersService], }) diff --git a/backend/test/test-setup.ts b/backend/test/test-setup.ts index 5f0fc4670..2c7d0bb85 100644 --- a/backend/test/test-setup.ts +++ b/backend/test/test-setup.ts @@ -77,8 +77,8 @@ import { PermissionsModule } from '../src/permissions/permissions.module'; import { PermissionsService } from '../src/permissions/permissions.service'; import { RevisionsModule } from '../src/revisions/revisions.module'; import { RevisionsService } from '../src/revisions/revisions.service'; -import { SessionModule } from '../src/session/session.module'; -import { SessionService } from '../src/session/session.service'; +import { SessionModule } from '../src/sessions/session.module'; +import { SessionService } from '../src/sessions/session.service'; import { User } from '../src/users/user.entity'; import { UsersModule } from '../src/users/users.module'; import { UsersService } from '../src/users/users.service';