diff --git a/src/activity/activity.gql.ts b/src/activity/activity.gql.ts index a3a2150..edfc457 100644 --- a/src/activity/activity.gql.ts +++ b/src/activity/activity.gql.ts @@ -1,4 +1,5 @@ import DataLoader from 'dataloader'; + import { QuizlordContext } from '..'; import { authorisationService, activityService, userService } from '../service.locator'; import { RecentActivityItem } from './activity.service'; diff --git a/src/auth/authorisation.service.ts b/src/auth/authorisation.service.ts index 9768c74..985322f 100644 --- a/src/auth/authorisation.service.ts +++ b/src/auth/authorisation.service.ts @@ -1,4 +1,5 @@ import { Role } from '@prisma/client'; + import { QuizlordContext } from '..'; import { UnauthorisedError } from './authorisation.errors'; diff --git a/src/index.ts b/src/index.ts index 7d17e1f..9d18a85 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,22 +1,22 @@ -import './instrument'; import { ApolloServer } from '@apollo/server'; import { expressMiddleware } from '@apollo/server/express4'; import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'; +import * as Sentry from '@sentry/node'; import bodyParser from 'body-parser'; import cors from 'cors'; import express from 'express'; import { GraphQLScalarType, Kind } from 'graphql'; import http from 'http'; -import * as Sentry from '@sentry/node'; -import { authenticationService, prismaService, queueService, userService } from './service.locator'; +import { activityQueries, activityChildren } from './activity/activity.gql'; import config from './config/config'; import typeDefs from './gql'; -import { userQueries } from './user/user.gql'; -import { activityQueries, activityChildren } from './activity/activity.gql'; +import './instrument'; import { quizMutations, quizQueries } from './quiz/quiz.gql'; -import { Role } from './user/user.dto'; +import { authenticationService, prismaService, queueService, userService } from './service.locator'; import { statisticsQueries } from './statistics/statistics.gql'; +import { Role } from './user/user.dto'; +import { userQueries } from './user/user.gql'; const QUIZLORD_VERSION_HEADER = 'X-Quizlord-Api-Version'; diff --git a/src/instrument.ts b/src/instrument.ts index af6c3b2..f86365b 100644 --- a/src/instrument.ts +++ b/src/instrument.ts @@ -1,5 +1,7 @@ import * as Sentry from '@sentry/node'; + import config from './config/config'; + Sentry.init({ dsn: config.SENTRY_DSN, integrations: [Sentry.prismaIntegration()], diff --git a/src/quiz/quiz.gql.ts b/src/quiz/quiz.gql.ts index 435a3ea..c47180b 100644 --- a/src/quiz/quiz.gql.ts +++ b/src/quiz/quiz.gql.ts @@ -1,6 +1,6 @@ import { QuizlordContext } from '..'; -import { base64Decode, base64Encode, PagedResult } from '../util/paging-helpers'; import { authorisationService, quizService } from '../service.locator'; +import { base64Decode, base64Encode, PagedResult } from '../util/paging-helpers'; import { CreateQuizResult, Quiz, QuizCompletion, QuizDetails, QuizFilters, QuizImageType, QuizType } from './quiz.dto'; async function quizzes( diff --git a/src/quiz/quiz.persistence.ts b/src/quiz/quiz.persistence.ts index 1f6b3b5..9efe513 100644 --- a/src/quiz/quiz.persistence.ts +++ b/src/quiz/quiz.persistence.ts @@ -2,8 +2,8 @@ import { Quiz, QuizImage, QuizNoteType } from '@prisma/client'; import { v4 as uuidv4 } from 'uuid'; import { PrismaService } from '../database/prisma.service'; -import { QuizFilters } from './quiz.dto'; import { slicePagedResults, getPagedQuery } from '../util/paging-helpers'; +import { QuizFilters } from './quiz.dto'; export class QuizPersistence { #prisma: PrismaService; diff --git a/src/quiz/quiz.service.test.ts b/src/quiz/quiz.service.test.ts index dbf23c3..00b47b2 100644 --- a/src/quiz/quiz.service.test.ts +++ b/src/quiz/quiz.service.test.ts @@ -1,11 +1,11 @@ +import { Decimal } from '@prisma/client/runtime/library'; import { v4 as uuidv4, Version4Options } from 'uuid'; -import { QuizService } from './quiz.service'; -import { QuizPersistence } from './quiz.persistence'; import { S3FileService } from '../file/s3.service'; -import { Decimal } from '@prisma/client/runtime/library'; import { UserService } from '../user/user.service'; import { MustProvideAtLeastOneFileError } from './quiz.errors'; +import { QuizPersistence } from './quiz.persistence'; +import { QuizService } from './quiz.service'; jest.mock('uuid'); diff --git a/src/quiz/quiz.service.ts b/src/quiz/quiz.service.ts index efbe090..84f3784 100644 --- a/src/quiz/quiz.service.ts +++ b/src/quiz/quiz.service.ts @@ -1,4 +1,3 @@ -import { v4 as uuidv4 } from 'uuid'; import { Quiz as QuizPersistenceModel, QuizCompletion as QuizCompletionPersistenceModel, @@ -8,12 +7,13 @@ import { QuizImageType, QuizType, } from '@prisma/client'; +import { v4 as uuidv4 } from 'uuid'; -import { Quiz, QuizCompletion, QuizFilters, QuizImage } from './quiz.dto'; import { S3FileService } from '../file/s3.service'; -import { QuizPersistence } from './quiz.persistence'; import { UserService } from '../user/user.service'; +import { Quiz, QuizCompletion, QuizFilters, QuizImage } from './quiz.dto'; import { MustProvideAtLeastOneFileError } from './quiz.errors'; +import { QuizPersistence } from './quiz.persistence'; const MAXIMUM_QUIZ_PAGE_SIZE = 100; diff --git a/src/service.locator.ts b/src/service.locator.ts index 67065e1..3c66252 100644 --- a/src/service.locator.ts +++ b/src/service.locator.ts @@ -1,6 +1,7 @@ import { ActivityService } from './activity/activity.service'; import { AuthenticationService } from './auth/authentication.service'; import { AuthorisationService } from './auth/authorisation.service'; +import config from './config/config'; import { PrismaService } from './database/prisma.service'; import { S3FileService } from './file/s3.service'; import { SQSQueueService } from './queue/sqs.service'; @@ -11,8 +12,6 @@ import { UserPersistence } from './user/user.persistence'; import { UserService } from './user/user.service'; import { MemoryCache } from './util/cache'; -import config from './config/config'; - const memoryCache = new MemoryCache(); // auth diff --git a/src/statistics/statistics.service.test.ts b/src/statistics/statistics.service.test.ts index a75ece1..5bd025e 100644 --- a/src/statistics/statistics.service.test.ts +++ b/src/statistics/statistics.service.test.ts @@ -1,8 +1,8 @@ -import { Cache } from '../util/cache'; import { QuizService } from '../quiz/quiz.service'; import { UserService } from '../user/user.service'; -import { StatisticsService } from './statistics.service'; +import { Cache } from '../util/cache'; import { IndividualUserStatisticsSortOption } from './statistics.dto'; +import { StatisticsService } from './statistics.service'; const mockUserService = { getUsers: jest.fn(), diff --git a/src/user/user.gql.ts b/src/user/user.gql.ts index f69f769..7ec4e8c 100644 --- a/src/user/user.gql.ts +++ b/src/user/user.gql.ts @@ -1,6 +1,6 @@ import { QuizlordContext } from '..'; -import { base64Decode, base64Encode, PagedResult } from '../util/paging-helpers'; import { authorisationService, userService } from '../service.locator'; +import { base64Decode, base64Encode, PagedResult } from '../util/paging-helpers'; import { User, UserDetails, UserSortOption } from './user.dto'; import { GetUsersResult } from './user.service'; diff --git a/src/user/user.persistence.ts b/src/user/user.persistence.ts index fb1910d..0b66e13 100644 --- a/src/user/user.persistence.ts +++ b/src/user/user.persistence.ts @@ -1,9 +1,9 @@ import { Role, User } from '@prisma/client'; +import { RecentActivityItem } from '../activity/activity.service'; import { PrismaService } from '../database/prisma.service'; import { UserSortOption } from '../user/user.dto'; import { getPagedQuery, slicePagedResults } from '../util/paging-helpers'; -import { RecentActivityItem } from '../activity/activity.service'; export interface GetUsersWithRoleResult { data: { diff --git a/src/user/user.service.test.ts b/src/user/user.service.test.ts index 02790c5..b5ccd26 100644 --- a/src/user/user.service.test.ts +++ b/src/user/user.service.test.ts @@ -1,8 +1,8 @@ import { v4 as uuidv4, Version4Options } from 'uuid'; +import { UserNotFoundError } from './user.errors'; import { UserPersistence } from './user.persistence'; import { UserService } from './user.service'; -import { UserNotFoundError } from './user.errors'; jest.mock('uuid'); diff --git a/src/user/user.service.ts b/src/user/user.service.ts index 33e40e2..54662da 100644 --- a/src/user/user.service.ts +++ b/src/user/user.service.ts @@ -1,10 +1,10 @@ -import { v4 as uuidv4 } from 'uuid'; import { User as UserPersistenceModel, Role as RolePersistenceModel } from '@prisma/client'; +import { v4 as uuidv4 } from 'uuid'; +import { RecentActivityItem } from '../activity/activity.service'; import { Role, User, UserSortOption } from './user.dto'; -import { UserPersistence } from './user.persistence'; import { UserNotFoundError } from './user.errors'; -import { RecentActivityItem } from '../activity/activity.service'; +import { UserPersistence } from './user.persistence'; export interface GetUsersResult { data: User[];