Skip to content

Commit

Permalink
Reorganized imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRibcage committed Jun 25, 2024
1 parent 39e6170 commit 98fb5f6
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 47 deletions.
4 changes: 2 additions & 2 deletions app/challenges-platform/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export {
AccessibleChallengesService,
ChallengesService,
ParticipantsService,
ReviewsService,
SubmissionService,
AccessibleChallengesService,
} from "./services";
import { Transformer } from "./models";
import { transformers } from "../../config/challenges-platform/transformers";
import { Transformer } from "./models";
import { BaseTransformer } from "./models/Transformer";

class ChallengesPlatform {
Expand Down
2 changes: 1 addition & 1 deletion app/challenges-platform/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { Challenge, Format, Evaluation } from "./Challenge";
export { Challenge, Evaluation, Format } from "./Challenge";
export { Participant } from "./Participant";
export { Review, Status } from "./Review";
export { Submission } from "./Submission";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { accessibleChallenges } from "../../../db/schema";
import { Ok, Result } from "ts-results";
import { eq } from "drizzle-orm";
import { Ok, Result } from "ts-results";
import { db } from "../../../db";
import { accessibleChallenges } from "../../../db/schema";
import { Challenge, Participant } from "../models";

export const count = async (
Expand Down
6 changes: 3 additions & 3 deletions app/challenges-platform/services/challenges-service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { eq } from "drizzle-orm";
import { Ok, Err, Result } from "ts-results";
import { Challenge, Format, Evaluation } from "../models/Challenge";
import { Err, Ok, Result } from "ts-results";
import { uuid } from "../../../app/common";
import { db } from "../../../db";
import { challenges } from "../../../db/schema";
import { uuid } from "../../../app/common";
import { challengesPlatform } from "../index";
import { Challenge } from "../models/Challenge";

export const findByUuid = async (
id: string,
Expand Down
6 changes: 3 additions & 3 deletions app/challenges-platform/services/participants-service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { eq } from "drizzle-orm";
import { Ok, Err, Result } from "ts-results";
import { Participant } from "../models/Participant";
import { Err, Ok, Result } from "ts-results";
import { uuid } from "../../../app/common";
import { db } from "../../../db";
import { participants } from "../../../db/schema";
import { uuid } from "../../../app/common";
import { Participant } from "../models/Participant";

export const findByUuid = async (
id: string,
Expand Down
6 changes: 3 additions & 3 deletions app/challenges-platform/services/reviews-service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { eq } from "drizzle-orm";
import { Ok, Err, Result } from "ts-results";
import { Review, Status } from "../models/Review";
import { Err, Ok, Result } from "ts-results";
import { uuid } from "../../../app/common";
import { db } from "../../../db";
import { reviews } from "../../../db/schema";
import { uuid } from "../../../app/common";
import { Review, Status } from "../models/Review";

export const findByUuid = async (
id: string,
Expand Down
6 changes: 3 additions & 3 deletions app/challenges-platform/services/submissions-service.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { eq } from "drizzle-orm";
import { Ok, Err, Result } from "ts-results";
import { Err, Ok, Result } from "ts-results";
import { challengesPlatform } from "..";
import { uuid } from "../../../app/common";
import { db } from "../../../db";
import { submissions } from "../../../db/schema";
import { uuid } from "../../../app/common";
import { Challenge, Participant, Submission } from "../models";
import {
AccessibleChallengesService,
ChallengesService,
ParticipantsService,
} from "../services";
import { challengesPlatform } from "..";

export const findByUuid = async (
id: string,
Expand Down
4 changes: 2 additions & 2 deletions config/challenges-platform/transformers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GithubIssueTransformer } from "../../app/event-management/models/GithubIssueChallenge";
import { Transformer } from "../../app/challenges-platform/models";
import { FlagTransformer } from "../../app/event-management/models/FlagChallenge";
import { GithubIssueTransformer } from "../../app/event-management/models/GithubIssueChallenge";
import { PhotoTransformer } from "../../app/event-management/models/PhotoChallenge";
import { Transformer } from "../../app/challenges-platform/models";

export const transformers: { [name: string]: typeof Transformer } = {
flag: FlagTransformer,
Expand Down
4 changes: 2 additions & 2 deletions config/express/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import express, { Express } from "express";
import cors from "cors";
import dotenv from "dotenv";
import { notFound, errorHandler } from "./middleware";
import express, { Express } from "express";
import { errorHandler, notFound } from "./middleware";
import { default as restRouter } from "./router";

dotenv.config();
Expand Down
4 changes: 2 additions & 2 deletions db/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Database from "better-sqlite3";
import dotenv from "dotenv";
import {
drizzle,
type BetterSQLite3Database,
} from "drizzle-orm/better-sqlite3";
import Database from "better-sqlite3";
import dotenv from "dotenv";

import * as schema from "./schema";

Expand Down
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Config } from "drizzle-kit";
import dotenv from "dotenv";
import type { Config } from "drizzle-kit";

dotenv.config();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { challengeFactory } from "./challenge-factory";
import { participantFactory } from "./participant-factory";
import {
Challenge,
Participant,
} from "../../../app/challenges-platform/models";
import { db } from "../../../db";
import { accessibleChallenges } from "../../../db/schema";
import { challengeFactory } from "./challenge-factory";
import { participantFactory } from "./participant-factory";

export const accessibleChallengeFactory = async ({
challenge,
Expand Down
2 changes: 1 addition & 1 deletion test/challenges-platform/factories/participant-factory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ParticipantsService } from "../../../app/challenges-platform/services";
import { Participant } from "../../../app/challenges-platform/models";
import { ParticipantsService } from "../../../app/challenges-platform/services";

export const participantFactory = async (
email?: string,
Expand Down
6 changes: 3 additions & 3 deletions test/challenges-platform/factories/submission-factory.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { challengeFactory } from "./challenge-factory";
import { participantFactory } from "./participant-factory";
import { SubmissionService } from "../../../app/challenges-platform";
import {
Challenge,
Participant,
Submission,
} from "../../../app/challenges-platform/models";
import { SubmissionService } from "../../../app/challenges-platform";
import { challengeFactory } from "./challenge-factory";
import { participantFactory } from "./participant-factory";

export const submissionFactory = async ({
participant,
Expand Down
2 changes: 1 addition & 1 deletion test/challenges-platform/models/Transformer.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { BaseTransformer } from "../../../app/challenges-platform/models/Transformer";
import {
Challenge,
Evaluation,
Format,
} from "../../../app/challenges-platform/models";
import { BaseTransformer } from "../../../app/challenges-platform/models/Transformer";

describe("BaseTransformer", () => {
describe("newChallenge", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AccessibleChallengesService } from "../../../app/challenges-platform";
import { accessibleChallengeFactory } from "../factories/accessible-challenge-factory";
import { challengeFactory } from "../factories/challenge-factory";
import { participantFactory } from "../factories/participant-factory";
import { accessibleChallengeFactory } from "../factories/accessible-challenge-factory";
import { AccessibleChallengesService } from "../../../app/challenges-platform";

describe("AccessibleChallengesService", () => {
describe("count", () => {
Expand Down
11 changes: 6 additions & 5 deletions test/challenges-platform/services/challenges-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ChallengesService } from "../../../app/challenges-platform";
import { challengeFactory } from "../factories/challenge-factory";
import { CustomTransformer, CustomChallenge } from "../custom-transformer";
import { challengesPlatform } from "../../../app/challenges-platform";
import { desc } from "drizzle-orm";
import {
ChallengesService,
challengesPlatform,
} from "../../../app/challenges-platform";
import { uuid } from "../../../app/common";
import { CustomChallenge, CustomTransformer } from "../custom-transformer";
import { challengeFactory } from "../factories/challenge-factory";

describe("ChallengesService", () => {
describe("findByUuid", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ParticipantsService } from "../../../app/challenges-platform";
import { participantFactory } from "../factories/participant-factory";
import { uuid } from "../../../app/common";
import { participantFactory } from "../factories/participant-factory";

describe("ParticipantsService", () => {
describe("create", () => {
Expand Down
4 changes: 1 addition & 3 deletions test/challenges-platform/services/reviews-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { ReviewsService } from "../../../app/challenges-platform";
import { Status } from "../../../app/challenges-platform/models";
import { uuid } from "../../../app/common";
import { accessibleChallengeFactory } from "../factories/accessible-challenge-factory";
import { reviewFactory } from "../factories/review-factory";
import { challengeFactory } from "../factories/challenge-factory";
import { participantFactory } from "../factories/participant-factory";
import { submissionFactory } from "../factories/submission-factory";
import { accessibleChallengeFactory } from "../factories/accessible-challenge-factory";

describe("ReviewsService", () => {
describe("create", () => {
Expand Down
4 changes: 2 additions & 2 deletions test/challenges-platform/services/submissions-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
ChallengesService,
SubmissionService,
} from "../../../app/challenges-platform";
import { uuid } from "../../../app/common";
import { accessibleChallengeFactory } from "../factories/accessible-challenge-factory";
import { challengeFactory } from "../factories/challenge-factory";
import { participantFactory } from "../factories/participant-factory";
import { accessibleChallengeFactory } from "../factories/accessible-challenge-factory";
import { uuid } from "../../../app/common";

describe("SubmissionService", () => {
describe("findByUuid", () => {
Expand Down
8 changes: 5 additions & 3 deletions test/event-management/models/FlagChallenge.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { FlagChallenge } from "../../../app/event-management/models/FlagChallenge";
import { FlagChallengeSubmission } from "../../../app/event-management/models/FlagChallenge";
import { Format } from "../../../app/challenges-platform/models";
import { FlagTransformer } from "../../../app/event-management/models/FlagChallenge";
import {
FlagChallenge,
FlagChallengeSubmission,
FlagTransformer,
} from "../../../app/event-management/models/FlagChallenge";
import { challengeFactory } from "../../challenges-platform/factories/challenge-factory";
import { participantFactory } from "../../challenges-platform/factories/participant-factory";

Expand Down

0 comments on commit 98fb5f6

Please sign in to comment.