mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
Enforce import order with prettier
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
879fd1be5a
commit
5ed2fae44e
130 changed files with 592 additions and 610 deletions
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { ConfigController } from './config.controller';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { FrontendConfigModule } from '../../../frontend-config/frontend-config.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import authConfigMock from '../../../config/mock/auth.config.mock';
|
||||
import customizationConfigMock from '../../../config/mock/customization.config.mock';
|
||||
import externalConfigMock from '../../../config/mock/external-services.config.mock';
|
||||
import { FrontendConfigModule } from '../../../frontend-config/frontend-config.module';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { ConfigController } from './config.controller';
|
||||
|
||||
describe('ConfigController', () => {
|
||||
let controller: ConfigController;
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { FrontendConfigService } from '../../../frontend-config/frontend-config.service';
|
||||
|
||||
import { FrontendConfigDto } from '../../../frontend-config/frontend-config.dto';
|
||||
import { FrontendConfigService } from '../../../frontend-config/frontend-config.service';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
|
||||
@Controller('config')
|
||||
export class ConfigController {
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Author } from '../../../../authors/author.entity';
|
||||
import { Session } from '../../../../users/session.entity';
|
||||
import { HistoryController } from './history.controller';
|
||||
import { LoggerModule } from '../../../../logger/logger.module';
|
||||
import { UsersModule } from '../../../../users/users.module';
|
||||
import { HistoryModule } from '../../../../history/history.module';
|
||||
import { NotesModule } from '../../../../notes/notes.module';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
import { User } from '../../../../users/user.entity';
|
||||
import { Note } from '../../../../notes/note.entity';
|
||||
|
||||
import { AuthToken } from '../../../../auth/auth-token.entity';
|
||||
import { Identity } from '../../../../users/identity.entity';
|
||||
import { Edit } from '../../../../revisions/edit.entity';
|
||||
import { Revision } from '../../../../revisions/revision.entity';
|
||||
import { Tag } from '../../../../notes/tag.entity';
|
||||
import { Author } from '../../../../authors/author.entity';
|
||||
import appConfigMock from '../../../../config/mock/app.config.mock';
|
||||
import { Group } from '../../../../groups/group.entity';
|
||||
import { HistoryEntry } from '../../../../history/history-entry.entity';
|
||||
import { HistoryModule } from '../../../../history/history.module';
|
||||
import { LoggerModule } from '../../../../logger/logger.module';
|
||||
import { Note } from '../../../../notes/note.entity';
|
||||
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 { Group } from '../../../../groups/group.entity';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import appConfigMock from '../../../../config/mock/app.config.mock';
|
||||
import { Edit } from '../../../../revisions/edit.entity';
|
||||
import { Revision } from '../../../../revisions/revision.entity';
|
||||
import { Identity } from '../../../../users/identity.entity';
|
||||
import { Session } from '../../../../users/session.entity';
|
||||
import { User } from '../../../../users/user.entity';
|
||||
import { UsersModule } from '../../../../users/users.module';
|
||||
import { HistoryController } from './history.controller';
|
||||
|
||||
describe('HistoryController', () => {
|
||||
let controller: HistoryController;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
|
@ -16,13 +15,14 @@ import {
|
|||
Put,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { UsersService } from '../../../../users/users.service';
|
||||
import { HistoryEntryDto } from '../../../../history/history-entry.dto';
|
||||
|
||||
import { ForbiddenIdError, NotInDBError } from '../../../../errors/errors';
|
||||
import { HistoryEntryImportDto } from '../../../../history/history-entry-import.dto';
|
||||
import { HistoryEntryUpdateDto } from '../../../../history/history-entry-update.dto';
|
||||
import { ConsoleLoggerService } from '../../../../logger/console-logger.service';
|
||||
import { HistoryEntryDto } from '../../../../history/history-entry.dto';
|
||||
import { HistoryService } from '../../../../history/history.service';
|
||||
import { ConsoleLoggerService } from '../../../../logger/console-logger.service';
|
||||
import { UsersService } from '../../../../users/users.service';
|
||||
|
||||
@ApiTags('history')
|
||||
@Controller('/me/history')
|
||||
|
|
|
@ -3,31 +3,31 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { MeController } from './me.controller';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import authConfigMock from '../../../config/mock/auth.config.mock';
|
||||
import customizationConfigMock from '../../../config/mock/customization.config.mock';
|
||||
import externalServicesConfigMock from '../../../config/mock/external-services.config.mock';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { Tag } from '../../../notes/tag.entity';
|
||||
import { NoteGroupPermission } from '../../../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../../../permissions/note-user-permission.entity';
|
||||
import { Edit } from '../../../revisions/edit.entity';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import authConfigMock from '../../../config/mock/auth.config.mock';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import customizationConfigMock from '../../../config/mock/customization.config.mock';
|
||||
import externalServicesConfigMock from '../../../config/mock/external-services.config.mock';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { Tag } from '../../../notes/tag.entity';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { MeController } from './me.controller';
|
||||
|
||||
describe('MeController', () => {
|
||||
let controller: MeController;
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Body, Controller, Delete, Get, HttpCode, Post } from '@nestjs/common';
|
||||
import { UserInfoDto } from '../../../users/user-info.dto';
|
||||
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { UsersService } from '../../../users/users.service';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { MediaUploadDto } from '../../../media/media-upload.dto';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { UserInfoDto } from '../../../users/user-info.dto';
|
||||
import { UsersService } from '../../../users/users.service';
|
||||
|
||||
@Controller('me')
|
||||
export class MeController {
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { MediaController } from './media.controller';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import authConfigMock from '../../../config/mock/auth.config.mock';
|
||||
import customizationConfigMock from '../../../config/mock/customization.config.mock';
|
||||
import externalConfigMock from '../../../config/mock/external-services.config.mock';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { NotesModule } from '../../../notes/notes.module';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Edit } from '../../../revisions/edit.entity';
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
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 { Group } from '../../../groups/group.entity';
|
||||
import { Edit } from '../../../revisions/edit.entity';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { MediaController } from './media.controller';
|
||||
|
||||
describe('MediaController', () => {
|
||||
let controller: MediaController;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
Controller,
|
||||
|
@ -14,16 +13,17 @@ import {
|
|||
UploadedFile,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { MulterFile } from '../../../media/multer-file.interface';
|
||||
import { MediaUploadUrlDto } from '../../../media/media-upload-url.dto';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
|
||||
import {
|
||||
ClientError,
|
||||
MediaBackendError,
|
||||
NotInDBError,
|
||||
} from '../../../errors/errors';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaUploadUrlDto } from '../../../media/media-upload-url.dto';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { MulterFile } from '../../../media/multer-file.interface';
|
||||
|
||||
@Controller('media')
|
||||
export class MediaController {
|
||||
|
|
|
@ -3,39 +3,39 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { NotesController } from './notes.controller';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { Tag } from '../../../notes/tag.entity';
|
||||
import { RevisionsModule } from '../../../revisions/revisions.module';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { GroupsModule } from '../../../groups/groups.module';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { PermissionsModule } from '../../../permissions/permissions.module';
|
||||
import { HistoryModule } from '../../../history/history.module';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { Edit } from '../../../revisions/edit.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { GroupsModule } from '../../../groups/groups.module';
|
||||
import { HistoryEntry } from '../../../history/history-entry.entity';
|
||||
import { HistoryModule } from '../../../history/history.module';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { Tag } from '../../../notes/tag.entity';
|
||||
import { NoteGroupPermission } from '../../../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../../../permissions/note-user-permission.entity';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { PermissionsModule } from '../../../permissions/permissions.module';
|
||||
import { Edit } from '../../../revisions/edit.entity';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { RevisionsModule } from '../../../revisions/revisions.module';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { NotesController } from './notes.controller';
|
||||
|
||||
describe('NotesController', () => {
|
||||
let controller: NotesController;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
|
@ -16,25 +15,26 @@ import {
|
|||
Post,
|
||||
UnauthorizedException,
|
||||
} from '@nestjs/common';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
|
||||
import {
|
||||
AlreadyInDBError,
|
||||
ForbiddenIdError,
|
||||
NotInDBError,
|
||||
} from '../../../errors/errors';
|
||||
import { NoteDto } from '../../../notes/note.dto';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { PermissionsService } from '../../../permissions/permissions.service';
|
||||
import { HistoryService } from '../../../history/history.service';
|
||||
import { UsersService } from '../../../users/users.service';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaUploadDto } from '../../../media/media-upload.dto';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { NoteDto } from '../../../notes/note.dto';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { NoteMediaDeletionDto } from '../../../notes/note.media-deletion.dto';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { PermissionsService } from '../../../permissions/permissions.service';
|
||||
import { RevisionMetadataDto } from '../../../revisions/revision-metadata.dto';
|
||||
import { RevisionDto } from '../../../revisions/revision.dto';
|
||||
import { RevisionsService } from '../../../revisions/revisions.service';
|
||||
import { UsersService } from '../../../users/users.service';
|
||||
import { MarkdownBody } from '../../utils/markdownbody-decorator';
|
||||
import { NoteMediaDeletionDto } from '../../../notes/note.media-deletion.dto';
|
||||
|
||||
@Controller('notes')
|
||||
export class NotesController {
|
||||
|
|
|
@ -3,23 +3,23 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TokensController } from './tokens/tokens.controller';
|
||||
import { LoggerModule } from '../../logger/logger.module';
|
||||
import { UsersModule } from '../../users/users.module';
|
||||
|
||||
import { AuthModule } from '../../auth/auth.module';
|
||||
import { MeController } from './me/me.controller';
|
||||
import { ConfigController } from './config/config.controller';
|
||||
import { FrontendConfigModule } from '../../frontend-config/frontend-config.module';
|
||||
import { HistoryController } from './me/history/history.controller';
|
||||
import { HistoryModule } from '../../history/history.module';
|
||||
import { NotesModule } from '../../notes/notes.module';
|
||||
import { LoggerModule } from '../../logger/logger.module';
|
||||
import { MediaModule } from '../../media/media.module';
|
||||
import { MediaController } from './media/media.controller';
|
||||
import { NotesController } from './notes/notes.controller';
|
||||
import { NotesModule } from '../../notes/notes.module';
|
||||
import { PermissionsModule } from '../../permissions/permissions.module';
|
||||
import { RevisionsModule } from '../../revisions/revisions.module';
|
||||
import { UsersModule } from '../../users/users.module';
|
||||
import { ConfigController } from './config/config.controller';
|
||||
import { HistoryController } from './me/history/history.controller';
|
||||
import { MeController } from './me/me.controller';
|
||||
import { MediaController } from './media/media.controller';
|
||||
import { NotesController } from './notes/notes.controller';
|
||||
import { TokensController } from './tokens/tokens.controller';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { TokensController } from './tokens.controller';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { AuthModule } from '../../../auth/auth.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { TokensController } from './tokens.controller';
|
||||
|
||||
describe('TokensController', () => {
|
||||
let controller: TokensController;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
|
@ -13,13 +12,14 @@ import {
|
|||
Param,
|
||||
Post,
|
||||
} from '@nestjs/common';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { AuthService } from '../../../auth/auth.service';
|
||||
import { TimestampMillis } from '../../../utils/timestamp';
|
||||
import { AuthTokenDto } from '../../../auth/auth-token.dto';
|
||||
import { AuthTokenWithSecretDto } from '../../../auth/auth-token-with-secret.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
import { AuthTokenWithSecretDto } from '../../../auth/auth-token-with-secret.dto';
|
||||
import { AuthTokenDto } from '../../../auth/auth-token.dto';
|
||||
import { AuthService } from '../../../auth/auth.service';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { TimestampMillis } from '../../../utils/timestamp';
|
||||
|
||||
@ApiTags('tokens')
|
||||
@Controller('tokens')
|
||||
export class TokensController {
|
||||
|
|
|
@ -3,36 +3,36 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { HistoryEntry } from '../../../history/history-entry.entity';
|
||||
import { HistoryModule } from '../../../history/history.module';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
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 { Edit } from '../../../revisions/edit.entity';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { MeController } from './me.controller';
|
||||
import { HistoryEntry } from '../../../history/history-entry.entity';
|
||||
import { NoteGroupPermission } from '../../../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../../../permissions/note-user-permission.entity';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
|
||||
describe('Me Controller', () => {
|
||||
let controller: MeController;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
|
@ -17,13 +16,6 @@ import {
|
|||
Req,
|
||||
InternalServerErrorException,
|
||||
} from '@nestjs/common';
|
||||
import { HistoryEntryUpdateDto } from '../../../history/history-entry-update.dto';
|
||||
import { HistoryService } from '../../../history/history.service';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { NoteMetadataDto } from '../../../notes/note-metadata.dto';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { UsersService } from '../../../users/users.service';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import {
|
||||
ApiNoContentResponse,
|
||||
ApiNotFoundResponse,
|
||||
|
@ -32,12 +24,20 @@ import {
|
|||
ApiTags,
|
||||
ApiUnauthorizedResponse,
|
||||
} from '@nestjs/swagger';
|
||||
import { HistoryEntryDto } from '../../../history/history-entry.dto';
|
||||
import { UserInfoDto } from '../../../users/user-info.dto';
|
||||
import { NotInDBError } from '../../../errors/errors';
|
||||
import { Request } from 'express';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import { NotInDBError } from '../../../errors/errors';
|
||||
import { HistoryEntryUpdateDto } from '../../../history/history-entry-update.dto';
|
||||
import { HistoryEntryDto } from '../../../history/history-entry.dto';
|
||||
import { HistoryService } from '../../../history/history.service';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaUploadDto } from '../../../media/media-upload.dto';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { NoteMetadataDto } from '../../../notes/note-metadata.dto';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { UserInfoDto } from '../../../users/user-info.dto';
|
||||
import { UsersService } from '../../../users/users.service';
|
||||
import {
|
||||
notFoundDescription,
|
||||
successfullyDeletedDescription,
|
||||
|
|
|
@ -3,29 +3,29 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
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 { Edit } from '../../../revisions/edit.entity';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { MediaController } from './media.controller';
|
||||
import { NoteGroupPermission } from '../../../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../../../permissions/note-user-permission.entity';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
|
||||
describe('Media Controller', () => {
|
||||
let controller: MediaController;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
Controller,
|
||||
|
@ -21,17 +20,6 @@ import {
|
|||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { Request } from 'express';
|
||||
import {
|
||||
ClientError,
|
||||
MediaBackendError,
|
||||
NotInDBError,
|
||||
PermissionError,
|
||||
} from '../../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { MulterFile } from '../../../media/multer-file.interface';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import {
|
||||
ApiBody,
|
||||
ApiConsumes,
|
||||
|
@ -43,7 +31,19 @@ import {
|
|||
ApiTags,
|
||||
ApiUnauthorizedResponse,
|
||||
} from '@nestjs/swagger';
|
||||
import { Request } from 'express';
|
||||
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import {
|
||||
ClientError,
|
||||
MediaBackendError,
|
||||
NotInDBError,
|
||||
PermissionError,
|
||||
} from '../../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaUploadUrlDto } from '../../../media/media-upload-url.dto';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { MulterFile } from '../../../media/multer-file.interface';
|
||||
import {
|
||||
forbiddenDescription,
|
||||
successfullyDeletedDescription,
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { MonitoringService } from '../../../monitoring/monitoring.service';
|
||||
import { MonitoringController } from './monitoring.controller';
|
||||
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Controller, Get, UseGuards } from '@nestjs/common';
|
||||
import { MonitoringService } from '../../../monitoring/monitoring.service';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import {
|
||||
ApiForbiddenResponse,
|
||||
ApiOkResponse,
|
||||
|
@ -15,6 +12,9 @@ import {
|
|||
ApiTags,
|
||||
ApiUnauthorizedResponse,
|
||||
} from '@nestjs/swagger';
|
||||
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import { MonitoringService } from '../../../monitoring/monitoring.service';
|
||||
import { ServerStatusDto } from '../../../monitoring/server-status.dto';
|
||||
import {
|
||||
forbiddenDescription,
|
||||
|
|
|
@ -3,39 +3,39 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Author } from '../../../authors/author.entity';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { GroupsModule } from '../../../groups/groups.module';
|
||||
import { HistoryEntry } from '../../../history/history-entry.entity';
|
||||
import { HistoryModule } from '../../../history/history.module';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { Tag } from '../../../notes/tag.entity';
|
||||
import { NoteGroupPermission } from '../../../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../../../permissions/note-user-permission.entity';
|
||||
import { PermissionsModule } from '../../../permissions/permissions.module';
|
||||
import { Edit } from '../../../revisions/edit.entity';
|
||||
import { Revision } from '../../../revisions/revision.entity';
|
||||
import { RevisionsModule } from '../../../revisions/revisions.module';
|
||||
import { AuthToken } from '../../../auth/auth-token.entity';
|
||||
import { Identity } from '../../../users/identity.entity';
|
||||
import { Session } from '../../../users/session.entity';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import { UsersModule } from '../../../users/users.module';
|
||||
import { NotesController } from './notes.controller';
|
||||
import { PermissionsModule } from '../../../permissions/permissions.module';
|
||||
import { HistoryModule } from '../../../history/history.module';
|
||||
import { HistoryEntry } from '../../../history/history-entry.entity';
|
||||
import { NoteGroupPermission } from '../../../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../../../permissions/note-user-permission.entity';
|
||||
import { Group } from '../../../groups/group.entity';
|
||||
import { GroupsModule } from '../../../groups/groups.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { MediaModule } from '../../../media/media.module';
|
||||
import { MediaUpload } from '../../../media/media-upload.entity';
|
||||
import appConfigMock from '../../../config/mock/app.config.mock';
|
||||
import mediaConfigMock from '../../../config/mock/media.config.mock';
|
||||
|
||||
describe('Notes Controller', () => {
|
||||
let controller: NotesController;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
|
@ -21,22 +20,6 @@ import {
|
|||
UnauthorizedException,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
AlreadyInDBError,
|
||||
ForbiddenIdError,
|
||||
NotInDBError,
|
||||
PermissionsUpdateInconsistentError,
|
||||
} from '../../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import {
|
||||
NotePermissionsDto,
|
||||
NotePermissionsUpdateDto,
|
||||
} from '../../../notes/note-permissions.dto';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { RevisionsService } from '../../../revisions/revisions.service';
|
||||
import { FullApi } from '../../utils/fullapi-decorator';
|
||||
import { MarkdownBody } from '../../utils/markdownbody-decorator';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import {
|
||||
ApiCreatedResponse,
|
||||
ApiForbiddenResponse,
|
||||
|
@ -47,22 +30,39 @@ import {
|
|||
ApiTags,
|
||||
ApiUnauthorizedResponse,
|
||||
} from '@nestjs/swagger';
|
||||
import { Request } from 'express';
|
||||
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import {
|
||||
AlreadyInDBError,
|
||||
ForbiddenIdError,
|
||||
NotInDBError,
|
||||
PermissionsUpdateInconsistentError,
|
||||
} from '../../../errors/errors';
|
||||
import { HistoryService } from '../../../history/history.service';
|
||||
import { NoteDto } from '../../../notes/note.dto';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
import { MediaUploadDto } from '../../../media/media-upload.dto';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { NoteMetadataDto } from '../../../notes/note-metadata.dto';
|
||||
import {
|
||||
NotePermissionsDto,
|
||||
NotePermissionsUpdateDto,
|
||||
} from '../../../notes/note-permissions.dto';
|
||||
import { NoteDto } from '../../../notes/note.dto';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { NoteMediaDeletionDto } from '../../../notes/note.media-deletion.dto';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { PermissionsService } from '../../../permissions/permissions.service';
|
||||
import { RevisionMetadataDto } from '../../../revisions/revision-metadata.dto';
|
||||
import { RevisionDto } from '../../../revisions/revision.dto';
|
||||
import { PermissionsService } from '../../../permissions/permissions.service';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { Request } from 'express';
|
||||
import { RevisionsService } from '../../../revisions/revisions.service';
|
||||
import {
|
||||
forbiddenDescription,
|
||||
successfullyDeletedDescription,
|
||||
unauthorizedDescription,
|
||||
} from '../../utils/descriptions';
|
||||
import { MediaUploadDto } from '../../../media/media-upload.dto';
|
||||
import { MediaService } from '../../../media/media.service';
|
||||
import { NoteMediaDeletionDto } from '../../../notes/note.media-deletion.dto';
|
||||
import { FullApi } from '../../utils/fullapi-decorator';
|
||||
import { MarkdownBody } from '../../utils/markdownbody-decorator';
|
||||
|
||||
@ApiTags('notes')
|
||||
@ApiSecurity('token')
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { HistoryModule } from '../../history/history.module';
|
||||
import { LoggerModule } from '../../logger/logger.module';
|
||||
import { MediaModule } from '../../media/media.module';
|
||||
import { MonitoringModule } from '../../monitoring/monitoring.module';
|
||||
import { NotesModule } from '../../notes/notes.module';
|
||||
import { PermissionsModule } from '../../permissions/permissions.module';
|
||||
import { RevisionsModule } from '../../revisions/revisions.module';
|
||||
import { UsersModule } from '../../users/users.module';
|
||||
import { MeController } from './me/me.controller';
|
||||
import { NotesController } from './notes/notes.controller';
|
||||
import { MediaController } from './media/media.controller';
|
||||
import { MonitoringController } from './monitoring/monitoring.controller';
|
||||
import { PermissionsModule } from '../../permissions/permissions.module';
|
||||
import { NotesController } from './notes/notes.controller';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { applyDecorators } from '@nestjs/common';
|
||||
import {
|
||||
ApiForbiddenResponse,
|
||||
ApiNotFoundResponse,
|
||||
ApiUnauthorizedResponse,
|
||||
} from '@nestjs/swagger';
|
||||
|
||||
import { forbiddenDescription, notFoundDescription } from './descriptions';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
createParamDecorator,
|
||||
|
|
|
@ -3,12 +3,26 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { ScheduleModule } from '@nestjs/schedule';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { RouterModule, Routes } from 'nest-router';
|
||||
|
||||
import { PrivateApiModule } from './api/private/private-api.module';
|
||||
import { PublicApiModule } from './api/public/public-api.module';
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import { AuthorsModule } from './authors/authors.module';
|
||||
import appConfig from './config/app.config';
|
||||
import authConfig from './config/auth.config';
|
||||
import cspConfig from './config/csp.config';
|
||||
import customizationConfig from './config/customization.config';
|
||||
import databaseConfig from './config/database.config';
|
||||
import externalConfig from './config/external-services.config';
|
||||
import hstsConfig from './config/hsts.config';
|
||||
import mediaConfig from './config/media.config';
|
||||
import { FrontendConfigModule } from './frontend-config/frontend-config.module';
|
||||
import { FrontendConfigService } from './frontend-config/frontend-config.service';
|
||||
import { GroupsModule } from './groups/groups.module';
|
||||
import { HistoryModule } from './history/history.module';
|
||||
import { LoggerModule } from './logger/logger.module';
|
||||
|
@ -18,20 +32,6 @@ import { NotesModule } from './notes/notes.module';
|
|||
import { PermissionsModule } from './permissions/permissions.module';
|
||||
import { RevisionsModule } from './revisions/revisions.module';
|
||||
import { UsersModule } from './users/users.module';
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import appConfig from './config/app.config';
|
||||
import mediaConfig from './config/media.config';
|
||||
import hstsConfig from './config/hsts.config';
|
||||
import cspConfig from './config/csp.config';
|
||||
import databaseConfig from './config/database.config';
|
||||
import authConfig from './config/auth.config';
|
||||
import customizationConfig from './config/customization.config';
|
||||
import externalConfig from './config/external-services.config';
|
||||
import { PrivateApiModule } from './api/private/private-api.module';
|
||||
import { ScheduleModule } from '@nestjs/schedule';
|
||||
import { RouterModule, Routes } from 'nest-router';
|
||||
import { FrontendConfigService } from './frontend-config/frontend-config.service';
|
||||
import { FrontendConfigModule } from './frontend-config/frontend-config.module';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
import { AuthTokenDto } from './auth-token.dto';
|
||||
|
||||
export class AuthTokenWithSecretDto extends AuthTokenDto {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsDate, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class AuthTokenDto {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
|
@ -11,6 +10,7 @@ import {
|
|||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
import { User } from '../users/user.entity';
|
||||
|
||||
@Entity()
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { TokenStrategy } from './token.strategy';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { AuthToken } from './auth-token.entity';
|
||||
import { AuthService } from './auth.service';
|
||||
import { TokenStrategy } from './token.strategy';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { AuthService } from './auth.service';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { PassportModule } from '@nestjs/passport';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { randomBytes } from 'crypto';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import { NotInDBError, TokenNotValidError } from '../errors/errors';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { Identity } from '../users/identity.entity';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { Identity } from '../users/identity.entity';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { AuthToken } from './auth-token.entity';
|
||||
import { NotInDBError, TokenNotValidError } from '../errors/errors';
|
||||
import { Repository } from 'typeorm';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import { randomBytes } from 'crypto';
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
describe('AuthService', () => {
|
||||
let service: AuthService;
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { UsersService } from '../users/users.service';
|
||||
import { User } from '../users/user.entity';
|
||||
import { AuthToken } from './auth-token.entity';
|
||||
import { AuthTokenDto } from './auth-token.dto';
|
||||
import { AuthTokenWithSecretDto } from './auth-token-with-secret.dto';
|
||||
import { Cron, Timeout } from '@nestjs/schedule';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { compare, hash } from 'bcrypt';
|
||||
import { randomBytes } from 'crypto';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import {
|
||||
NotInDBError,
|
||||
TokenNotValidError,
|
||||
TooManyTokensError,
|
||||
} from '../errors/errors';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersService } from '../users/users.service';
|
||||
import { TimestampMillis } from '../utils/timestamp';
|
||||
import { Cron, Timeout } from '@nestjs/schedule';
|
||||
import { randomBytes } from 'crypto';
|
||||
import { AuthTokenWithSecretDto } from './auth-token-with-secret.dto';
|
||||
import { AuthTokenDto } from './auth-token.dto';
|
||||
import { AuthToken } from './auth-token.entity';
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ExecutionContext, Injectable } from '@nestjs/common';
|
||||
import { UsersService } from '../users/users.service';
|
||||
import { User } from '../users/user.entity';
|
||||
import { Request } from 'express';
|
||||
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersService } from '../users/users.service';
|
||||
|
||||
@Injectable()
|
||||
export class MockAuthGuard {
|
||||
private user: User;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Strategy } from 'passport-http-bearer';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Injectable, UnauthorizedException } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { User } from '../users/user.entity';
|
||||
import { PassportStrategy } from '@nestjs/passport';
|
||||
import { Strategy } from 'passport-http-bearer';
|
||||
|
||||
import { NotInDBError, TokenNotValidError } from '../errors/errors';
|
||||
import { User } from '../users/user.entity';
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
@Injectable()
|
||||
export class TokenStrategy extends PassportStrategy(Strategy, 'token') {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
|
@ -11,6 +10,7 @@ import {
|
|||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
import { Edit } from '../revisions/edit.entity';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { Author } from './author.entity';
|
||||
|
||||
@Module({
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { Loglevel } from './loglevel.enum';
|
||||
import { buildErrorMessage, parseOptionalInt, toArrayConfig } from './utils';
|
||||
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { GitlabScope, GitlabVersion } from './gitlab.enum';
|
||||
import {
|
||||
buildErrorMessage,
|
||||
replaceAuthErrorsWithEnvironmentVariables,
|
||||
toArrayConfig,
|
||||
} from './utils';
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export interface AuthConfig {
|
||||
email: {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as Joi from 'joi';
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { buildErrorMessage } from './utils';
|
||||
|
||||
export interface CspConfig {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { buildErrorMessage } from './utils';
|
||||
|
||||
export interface CustomizationConfig {
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as Joi from 'joi';
|
||||
import { DatabaseDialect } from './database-dialect.enum';
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { DatabaseDialect } from './database-dialect.enum';
|
||||
import { buildErrorMessage, parseOptionalInt } from './utils';
|
||||
|
||||
export interface DatabaseConfig {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { buildErrorMessage } from './utils';
|
||||
|
||||
export interface ExternalServicesConfig {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as Joi from 'joi';
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { buildErrorMessage, parseOptionalInt } from './utils';
|
||||
|
||||
export interface HstsConfig {
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as Joi from 'joi';
|
||||
import { BackendType } from '../media/backends/backend-type.enum';
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import * as Joi from 'joi';
|
||||
|
||||
import { BackendType } from '../media/backends/backend-type.enum';
|
||||
import { buildErrorMessage } from './utils';
|
||||
|
||||
export interface MediaConfig {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
import { Loglevel } from '../loglevel.enum';
|
||||
|
||||
export default registerAs('appConfig', () => ({
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('authConfig', () => ({
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('customizationConfig', () => ({
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('externalServicesConfig', () => ({
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('mediaConfig', () => ({
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Loglevel } from './loglevel.enum';
|
||||
import {
|
||||
needToLog,
|
||||
parseOptionalInt,
|
||||
replaceAuthErrorsWithEnvironmentVariables,
|
||||
toArrayConfig,
|
||||
} from './utils';
|
||||
import { Loglevel } from './loglevel.enum';
|
||||
|
||||
describe('config utils', () => {
|
||||
describe('toArrayConfig', () => {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Loglevel } from './loglevel.enum';
|
||||
|
||||
export function toArrayConfig(configValue?: string, separator = ','): string[] {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
|
@ -13,6 +12,7 @@ import {
|
|||
IsUrl,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
|
||||
import { ServerVersion } from '../monitoring/server-status.dto';
|
||||
|
||||
export class AuthProviders {
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { FrontendConfigService } from './frontend-config.service';
|
||||
|
||||
@Module({
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { FrontendConfigService } from './frontend-config.service';
|
||||
import { ConfigModule, registerAs } from '@nestjs/config';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { AuthConfig } from '../config/auth.config';
|
||||
import { GitlabScope, GitlabVersion } from '../config/gitlab.enum';
|
||||
import { getServerVersionFromPackageJson } from '../utils/serverVersion';
|
||||
import { CustomizationConfig } from '../config/customization.config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { AppConfig } from '../config/app.config';
|
||||
import { AuthConfig } from '../config/auth.config';
|
||||
import { CustomizationConfig } from '../config/customization.config';
|
||||
import { ExternalServicesConfig } from '../config/external-services.config';
|
||||
import { GitlabScope, GitlabVersion } from '../config/gitlab.enum';
|
||||
import { Loglevel } from '../config/loglevel.enum';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { getServerVersionFromPackageJson } from '../utils/serverVersion';
|
||||
import { FrontendConfigService } from './frontend-config.service';
|
||||
|
||||
/* eslint-disable
|
||||
jest/no-conditional-expect
|
||||
|
|
|
@ -3,9 +3,18 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
|
||||
import appConfiguration, { AppConfig } from '../config/app.config';
|
||||
import authConfiguration, { AuthConfig } from '../config/auth.config';
|
||||
import customizationConfiguration, {
|
||||
CustomizationConfig,
|
||||
} from '../config/customization.config';
|
||||
import externalServicesConfiguration, {
|
||||
ExternalServicesConfig,
|
||||
} from '../config/external-services.config';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { getServerVersionFromPackageJson } from '../utils/serverVersion';
|
||||
import {
|
||||
AuthProviders,
|
||||
BrandingDto,
|
||||
|
@ -14,15 +23,6 @@ import {
|
|||
IframeCommunicationDto,
|
||||
SpecialUrlsDto,
|
||||
} from './frontend-config.dto';
|
||||
import authConfiguration, { AuthConfig } from '../config/auth.config';
|
||||
import customizationConfiguration, {
|
||||
CustomizationConfig,
|
||||
} from '../config/customization.config';
|
||||
import appConfiguration, { AppConfig } from '../config/app.config';
|
||||
import externalServicesConfiguration, {
|
||||
ExternalServicesConfig,
|
||||
} from '../config/external-services.config';
|
||||
import { getServerVersionFromPackageJson } from '../utils/serverVersion';
|
||||
|
||||
@Injectable()
|
||||
export class FrontendConfigService {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { IsBoolean, IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean, IsString } from 'class-validator';
|
||||
|
||||
export class GroupInfoDto {
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
|
@ -11,6 +10,7 @@ import {
|
|||
ManyToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
import { User } from '../users/user.entity';
|
||||
|
||||
@Entity()
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { Group } from './group.entity';
|
||||
import { GroupsService } from './groups.service';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Group]), LoggerModule],
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { GroupsService } from './groups.service';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Group } from './group.entity';
|
||||
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import { NotInDBError } from '../errors/errors';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import { Group } from './group.entity';
|
||||
import { GroupsService } from './groups.service';
|
||||
|
||||
describe('GroupsService', () => {
|
||||
let service: GroupsService;
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Group } from './group.entity';
|
||||
|
||||
import { NotInDBError } from '../errors/errors';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { GroupInfoDto } from './group-info.dto';
|
||||
import { Group } from './group.entity';
|
||||
|
||||
@Injectable()
|
||||
export class GroupsService {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsBoolean, IsDate, IsString } from 'class-validator';
|
||||
|
||||
export class HistoryEntryImportDto {
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsBoolean } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
|
||||
export class HistoryEntryUpdateDto {
|
||||
/**
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsArray, IsBoolean, IsDate, IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, IsBoolean, IsDate, IsString } from 'class-validator';
|
||||
|
||||
export class HistoryEntryDto {
|
||||
/**
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Column, Entity, ManyToOne, UpdateDateColumn } from 'typeorm';
|
||||
import { User } from '../users/user.entity';
|
||||
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
|
||||
@Entity()
|
||||
export class HistoryEntry {
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { HistoryService } from './history.service';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { HistoryEntry } from './history-entry.entity';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { NotesModule } from '../notes/notes.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { NotesModule } from '../notes/notes.module';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { HistoryEntry } from './history-entry.entity';
|
||||
import { HistoryService } from './history.service';
|
||||
|
||||
@Module({
|
||||
providers: [HistoryService],
|
||||
|
|
|
@ -3,31 +3,31 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Author } from '../authors/author.entity';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { HistoryService } from './history.service';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { NotesModule } from '../notes/notes.module';
|
||||
import { getConnectionToken, getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Identity } from '../users/identity.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { Edit } from '../revisions/edit.entity';
|
||||
import { HistoryEntry } from './history-entry.entity';
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { Tag } from '../notes/tag.entity';
|
||||
import { AuthToken } from '../auth/auth-token.entity';
|
||||
import { Revision } from '../revisions/revision.entity';
|
||||
import { Connection, Repository } from 'typeorm';
|
||||
|
||||
import { AuthToken } from '../auth/auth-token.entity';
|
||||
import { Author } from '../authors/author.entity';
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import { NotInDBError } from '../errors/errors';
|
||||
import { Group } from '../groups/group.entity';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { Note } from '../notes/note.entity';
|
||||
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 { Group } from '../groups/group.entity';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import { Edit } from '../revisions/edit.entity';
|
||||
import { Revision } from '../revisions/revision.entity';
|
||||
import { Identity } from '../users/identity.entity';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { HistoryEntryImportDto } from './history-entry-import.dto';
|
||||
import { HistoryEntry } from './history-entry.entity';
|
||||
import { HistoryService } from './history.service';
|
||||
|
||||
describe('HistoryService', () => {
|
||||
let service: HistoryService;
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { HistoryEntryUpdateDto } from './history-entry-update.dto';
|
||||
import { HistoryEntryDto } from './history-entry.dto';
|
||||
import { InjectConnection, InjectRepository } from '@nestjs/typeorm';
|
||||
import { Connection, Repository } from 'typeorm';
|
||||
import { HistoryEntry } from './history-entry.entity';
|
||||
import { UsersService } from '../users/users.service';
|
||||
|
||||
import { NotInDBError } from '../errors/errors';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { NotesService } from '../notes/notes.service';
|
||||
import { User } from '../users/user.entity';
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { NotInDBError } from '../errors/errors';
|
||||
import { UsersService } from '../users/users.service';
|
||||
import { HistoryEntryImportDto } from './history-entry-import.dto';
|
||||
import { HistoryEntryUpdateDto } from './history-entry-update.dto';
|
||||
import { HistoryEntryDto } from './history-entry.dto';
|
||||
import { HistoryEntry } from './history-entry.entity';
|
||||
|
||||
@Injectable()
|
||||
export class HistoryService {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
Inject,
|
||||
Injectable,
|
||||
|
@ -12,12 +11,14 @@ import {
|
|||
Scope,
|
||||
} from '@nestjs/common';
|
||||
import { isObject } from '@nestjs/common/utils/shared.utils';
|
||||
import clc = require('cli-color');
|
||||
import DateTimeFormatOptions = Intl.DateTimeFormatOptions;
|
||||
|
||||
import appConfiguration, { AppConfig } from '../config/app.config';
|
||||
import { Loglevel } from '../config/loglevel.enum';
|
||||
import { needToLog } from '../config/utils';
|
||||
|
||||
import clc = require('cli-color');
|
||||
import DateTimeFormatOptions = Intl.DateTimeFormatOptions;
|
||||
|
||||
@Injectable({ scope: Scope.TRANSIENT })
|
||||
export class ConsoleLoggerService implements LoggerService {
|
||||
private classContext: string | undefined;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { ConsoleLoggerService } from './console-logger.service';
|
||||
|
||||
@Module({
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { LogLevel, ValidationPipe } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
import { AppConfig } from './config/app.config';
|
||||
import { MediaConfig } from './config/media.config';
|
||||
import { setupPrivateApiDocs, setupPublicApiDocs } from './utils/swagger';
|
||||
import { BackendType } from './media/backends/backend-type.enum';
|
||||
import { ConsoleLoggerService } from './logger/console-logger.service';
|
||||
import { BackendType } from './media/backends/backend-type.enum';
|
||||
import { setupPrivateApiDocs, setupPublicApiDocs } from './utils/swagger';
|
||||
|
||||
async function bootstrap(): Promise<void> {
|
||||
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import mediaConfiguration, { MediaConfig } from '../../config/media.config';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendData } from '../media-upload.entity';
|
||||
import {
|
||||
BlobServiceClient,
|
||||
BlockBlobClient,
|
||||
ContainerClient,
|
||||
} from '@azure/storage-blob';
|
||||
import { BackendType } from './backend-type.enum';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
|
||||
import mediaConfiguration, { MediaConfig } from '../../config/media.config';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendData } from '../media-upload.entity';
|
||||
import { BackendType } from './backend-type.enum';
|
||||
|
||||
@Injectable()
|
||||
export class AzureBackend implements MediaBackend {
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { promises as fs } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
import mediaConfiguration from '../../config/media.config';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendData } from '../media-upload.entity';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
|
||||
@Injectable()
|
||||
export class FilesystemBackend implements MediaBackend {
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import fetch, { Response } from 'node-fetch';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
import mediaConfiguration from '../../config/media.config';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendData } from '../media-upload.entity';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import fetch, { Response } from 'node-fetch';
|
||||
import { URLSearchParams } from 'url';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
|
||||
type UploadResult = {
|
||||
data: {
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Client } from 'minio';
|
||||
|
||||
import mediaConfiguration from '../../config/media.config';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendData } from '../media-upload.entity';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import { Client } from 'minio';
|
||||
import { BackendType } from './backend-type.enum';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
|
||||
@Injectable()
|
||||
export class S3Backend implements MediaBackend {
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import fetch, { Response } from 'node-fetch';
|
||||
|
||||
import mediaConfiguration from '../../config/media.config';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendData } from '../media-upload.entity';
|
||||
import { MediaConfig } from '../../config/media.config';
|
||||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { BackendType } from './backend-type.enum';
|
||||
import fetch, { Response } from 'node-fetch';
|
||||
|
||||
@Injectable()
|
||||
export class WebdavBackend implements MediaBackend {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { BackendData } from './media-upload.entity';
|
||||
|
||||
export interface MediaBackend {
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class MediaUploadUrlDto {
|
||||
@IsString()
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { IsDate, IsOptional, IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsDate, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class MediaUploadDto {
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as crypto from 'crypto';
|
||||
import {
|
||||
Column,
|
||||
|
@ -12,6 +11,7 @@ import {
|
|||
ManyToOne,
|
||||
PrimaryColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { BackendType } from './backends/backend-type.enum';
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { NotesModule } from '../notes/notes.module';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { AzureBackend } from './backends/azure-backend';
|
||||
import { FilesystemBackend } from './backends/filesystem-backend';
|
||||
import { ImgurBackend } from './backends/imgur-backend';
|
||||
import { S3Backend } from './backends/s3-backend';
|
||||
import { WebdavBackend } from './backends/webdav-backend';
|
||||
import { MediaUpload } from './media-upload.entity';
|
||||
import { MediaService } from './media.service';
|
||||
import { S3Backend } from './backends/s3-backend';
|
||||
import { ImgurBackend } from './backends/imgur-backend';
|
||||
import { AzureBackend } from './backends/azure-backend';
|
||||
import { WebdavBackend } from './backends/webdav-backend';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
|
|
@ -3,19 +3,26 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { promises as fs } from 'fs';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import appConfigMock from '../../src/config/mock/app.config.mock';
|
||||
import { AuthToken } from '../auth/auth-token.entity';
|
||||
import { Author } from '../authors/author.entity';
|
||||
import mediaConfigMock from '../config/mock/media.config.mock';
|
||||
import { ClientError, NotInDBError } from '../errors/errors';
|
||||
import { Group } from '../groups/group.entity';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { Note } from '../notes/note.entity';
|
||||
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 { Edit } from '../revisions/edit.entity';
|
||||
import { Revision } from '../revisions/revision.entity';
|
||||
import { AuthToken } from '../auth/auth-token.entity';
|
||||
import { Identity } from '../users/identity.entity';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
|
@ -23,13 +30,6 @@ import { UsersModule } from '../users/users.module';
|
|||
import { FilesystemBackend } from './backends/filesystem-backend';
|
||||
import { BackendData, MediaUpload } from './media-upload.entity';
|
||||
import { MediaService } from './media.service';
|
||||
import { Repository } from 'typeorm';
|
||||
import { promises as fs } from 'fs';
|
||||
import { ClientError, NotInDBError } from '../errors/errors';
|
||||
import { NoteGroupPermission } from '../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../permissions/note-user-permission.entity';
|
||||
import { Group } from '../groups/group.entity';
|
||||
import appConfigMock from '../../src/config/mock/app.config.mock';
|
||||
|
||||
describe('MediaService', () => {
|
||||
let service: MediaService;
|
||||
|
|
|
@ -3,29 +3,29 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import * as FileType from 'file-type';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import mediaConfiguration, { MediaConfig } from '../config/media.config';
|
||||
import { ClientError, NotInDBError } from '../errors/errors';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { NotesService } from '../notes/notes.service';
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersService } from '../users/users.service';
|
||||
import { AzureBackend } from './backends/azure-backend';
|
||||
import { BackendType } from './backends/backend-type.enum';
|
||||
import { FilesystemBackend } from './backends/filesystem-backend';
|
||||
import { MediaBackend } from './media-backend.interface';
|
||||
import { MediaUpload } from './media-upload.entity';
|
||||
import { MediaUploadUrlDto } from './media-upload-url.dto';
|
||||
import { S3Backend } from './backends/s3-backend';
|
||||
import { AzureBackend } from './backends/azure-backend';
|
||||
import { ImgurBackend } from './backends/imgur-backend';
|
||||
import { User } from '../users/user.entity';
|
||||
import { MediaUploadDto } from './media-upload.dto';
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { S3Backend } from './backends/s3-backend';
|
||||
import { WebdavBackend } from './backends/webdav-backend';
|
||||
import { MediaBackend } from './media-backend.interface';
|
||||
import { MediaUploadUrlDto } from './media-upload-url.dto';
|
||||
import { MediaUploadDto } from './media-upload.dto';
|
||||
import { MediaUpload } from './media-upload.entity';
|
||||
|
||||
@Injectable()
|
||||
export class MediaService {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Readable } from 'stream';
|
||||
|
||||
// Type from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/multer/index.d.ts
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { MonitoringService } from './monitoring.service';
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { MonitoringService } from './monitoring.service';
|
||||
|
||||
describe('MonitoringService', () => {
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ServerStatusDto } from './server-status.dto';
|
||||
|
||||
import { getServerVersionFromPackageJson } from '../utils/serverVersion';
|
||||
import { ServerStatusDto } from './server-status.dto';
|
||||
|
||||
@Injectable()
|
||||
export class MonitoringService {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class ServerVersion {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import {
|
||||
IsArray,
|
||||
IsDate,
|
||||
|
@ -12,9 +12,9 @@ import {
|
|||
IsString,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
|
||||
import { UserInfoDto } from '../users/user-info.dto';
|
||||
import { NotePermissionsDto } from './note-permissions.dto';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
|
||||
export class NoteMetadataDto {
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
|
@ -11,9 +11,9 @@ import {
|
|||
IsString,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { UserInfoDto } from '../users/user-info.dto';
|
||||
|
||||
import { GroupInfoDto } from '../groups/group-info.dto';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { UserInfoDto } from '../users/user-info.dto';
|
||||
|
||||
export class NoteUserPermissionEntryDto {
|
||||
/**
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsArray, IsString, ValidateNested } from 'class-validator';
|
||||
|
||||
import { EditDto } from '../revisions/edit.dto';
|
||||
import { NoteMetadataDto } from './note-metadata.dto';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class NoteDto {
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
|
@ -13,13 +12,14 @@ import {
|
|||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
import { HistoryEntry } from '../history/history-entry.entity';
|
||||
import { MediaUpload } from '../media/media-upload.entity';
|
||||
import { NoteGroupPermission } from '../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../permissions/note-user-permission.entity';
|
||||
import { Revision } from '../revisions/revision.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { Tag } from './tag.entity';
|
||||
import { HistoryEntry } from '../history/history-entry.entity';
|
||||
import { MediaUpload } from '../media/media-upload.entity';
|
||||
import { generatePublicId } from './utils';
|
||||
|
||||
@Entity()
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { IsBoolean } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
|
||||
export class NoteMediaDeletionDto {
|
||||
/**
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { forwardRef, Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
|
||||
import { GroupsModule } from '../groups/groups.module';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { NoteGroupPermission } from '../permissions/note-group-permission.entity';
|
||||
|
|
|
@ -3,39 +3,39 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Author } from '../authors/author.entity';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
import { Edit } from '../revisions/edit.entity';
|
||||
import { Revision } from '../revisions/revision.entity';
|
||||
import { RevisionsModule } from '../revisions/revisions.module';
|
||||
import { AuthToken } from '../auth/auth-token.entity';
|
||||
import { Identity } from '../users/identity.entity';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { Note } from './note.entity';
|
||||
import { NotesService } from './notes.service';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Tag } from './tag.entity';
|
||||
|
||||
import { AuthToken } from '../auth/auth-token.entity';
|
||||
import { Author } from '../authors/author.entity';
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import {
|
||||
AlreadyInDBError,
|
||||
ForbiddenIdError,
|
||||
NotInDBError,
|
||||
PermissionsUpdateInconsistentError,
|
||||
} from '../errors/errors';
|
||||
import { Group } from '../groups/group.entity';
|
||||
import { GroupsModule } from '../groups/groups.module';
|
||||
import { LoggerModule } from '../logger/logger.module';
|
||||
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 { RevisionsModule } from '../revisions/revisions.module';
|
||||
import { Identity } from '../users/identity.entity';
|
||||
import { Session } from '../users/session.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import {
|
||||
NoteGroupPermissionUpdateDto,
|
||||
NoteUserPermissionUpdateDto,
|
||||
} from './note-permissions.dto';
|
||||
import { NoteGroupPermission } from '../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../permissions/note-user-permission.entity';
|
||||
import { GroupsModule } from '../groups/groups.module';
|
||||
import { Group } from '../groups/group.entity';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import appConfigMock from '../config/mock/app.config.mock';
|
||||
import { Note } from './note.entity';
|
||||
import { NotesService } from './notes.service';
|
||||
import { Tag } from './tag.entity';
|
||||
|
||||
describe('NotesService', () => {
|
||||
let service: NotesService;
|
||||
|
|
|
@ -3,21 +3,29 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import base32Encode from 'base32-encode';
|
||||
import { randomBytes } from 'crypto';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
import appConfiguration, { AppConfig } from '../config/app.config';
|
||||
import {
|
||||
AlreadyInDBError,
|
||||
ForbiddenIdError,
|
||||
NotInDBError,
|
||||
PermissionsUpdateInconsistentError,
|
||||
} from '../errors/errors';
|
||||
import { GroupsService } from '../groups/groups.service';
|
||||
import { HistoryEntry } from '../history/history-entry.entity';
|
||||
import { ConsoleLoggerService } from '../logger/console-logger.service';
|
||||
import { NoteGroupPermission } from '../permissions/note-group-permission.entity';
|
||||
import { NoteUserPermission } from '../permissions/note-user-permission.entity';
|
||||
import { Revision } from '../revisions/revision.entity';
|
||||
import { RevisionsService } from '../revisions/revisions.service';
|
||||
import { User } from '../users/user.entity';
|
||||
import { UsersService } from '../users/users.service';
|
||||
import { checkArrayForDuplicates } from '../utils/arrayDuplicatCheck';
|
||||
import { NoteMetadataDto } from './note-metadata.dto';
|
||||
import {
|
||||
NotePermissionsDto,
|
||||
|
@ -26,14 +34,6 @@ import {
|
|||
import { NoteDto } from './note.dto';
|
||||
import { Note } from './note.entity';
|
||||
import { Tag } from './tag.entity';
|
||||
import { HistoryEntry } from '../history/history-entry.entity';
|
||||
import { NoteUserPermission } from '../permissions/note-user-permission.entity';
|
||||
import { NoteGroupPermission } from '../permissions/note-group-permission.entity';
|
||||
import { GroupsService } from '../groups/groups.service';
|
||||
import { checkArrayForDuplicates } from '../utils/arrayDuplicatCheck';
|
||||
import appConfiguration, { AppConfig } from '../config/app.config';
|
||||
import base32Encode from 'base32-encode';
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
@Injectable()
|
||||
export class NotesService {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
|
||||
import { Note } from './note.entity';
|
||||
|
||||
@Entity()
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
import { generatePublicId } from './utils';
|
||||
|
||||
jest.mock('crypto');
|
||||
|
||||
it('generatePublicId', () => {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import base32Encode from 'base32-encode';
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Column, Entity, ManyToOne } from 'typeorm';
|
||||
|
||||
import { Group } from '../groups/group.entity';
|
||||
import { Note } from '../notes/note.entity';
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Column, Entity, ManyToOne } from 'typeorm';
|
||||
|
||||
import { Note } from '../notes/note.entity';
|
||||
import { User } from '../users/user.entity';
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue