Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# local database env variables
POSTGRES_DB_DEV=scv2
POSTGRES_DB_TEST=scv2_test
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
DB_HOST=scv2_db

MAILER_USER=
MAILER_REFRESH_TOKEN=
MAILER_CLIENT_SECRET=
MAILER_CLIENT_ID=
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:

- name: Set up Node.js
if: steps.changes.outputs.frontend == 'true' || steps.changes.outputs.typescript-backend == 'true'
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "20.11.1"
node-version: "20"
cache: "yarn"
cache-dependency-path: |
frontend/yarn.lock
Expand Down
4 changes: 3 additions & 1 deletion backend/typescript/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export default {
// ],

// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
Expand Down
4 changes: 2 additions & 2 deletions backend/typescript/middlewares/validators/entityValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
validateArray,
validateFileType,
validatePrimitive,
} from "./util";
import { getErrorMessage } from "../../utilities/errorUtils";
} from "@/middlewares/validators/util";
import { getErrorMessage } from "@/utilities/errorUtils";

/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable-next-line import/prefer-default-export */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
getApiValidationError,
validateArray,
validatePrimitive,
} from "./util";
} from "@/middlewares/validators/util";

/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable-next-line import/prefer-default-export */
Expand Down
6 changes: 6 additions & 0 deletions backend/typescript/migrate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable import/no-extraneous-dependencies */
const path = require("path");
require("dotenv").config({
path: path.join(__dirname, "..", "..", ".env"),
});
require("tsconfig-paths/register");
require("ts-node/register");

require("./umzug").migrator.runAsCLI();
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DataType } from "sequelize-typescript";

import { Migration } from "../umzug";
import { Migration } from "@/umzug";

const TABLE_NAME = "entities";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { DataType } from "sequelize-typescript";

import { Migration } from "@/umzug";

const TABLE_NAME = "simple_entities";

export const up: Migration = async ({ context: sequelize }) => {
await sequelize.getQueryInterface().createTable(TABLE_NAME, {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: DataType.INTEGER,
},
string_field: {
type: DataType.STRING,
allowNull: false,
},
int_field: {
type: DataType.INTEGER,
allowNull: false,
},
enum_field: {
type: DataType.ENUM("A", "B", "C", "D"),
allowNull: false,
},
string_array_field: {
type: DataType.ARRAY(DataType.STRING),
allowNull: false,
},
bool_field: {
type: DataType.BOOLEAN,
allowNull: false,
},
createdAt: DataType.DATE,
updatedAt: DataType.DATE,
});
};

export const down: Migration = async ({ context: sequelize }) => {
await sequelize.getQueryInterface().dropTable(TABLE_NAME);
};
3 changes: 1 addition & 2 deletions backend/typescript/models/entity.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Column, Model, Table, DataType } from "sequelize-typescript";

import { Letters } from "../types";
import { Letters } from "@/types";

@Table({ tableName: "entities" })
export default class Entity extends Model {
Expand All @@ -22,4 +22,3 @@ export default class Entity extends Model {
@Column
file_name!: string;
}

1 change: 0 additions & 1 deletion backend/typescript/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ const DATABASE_URL =
export const sequelize = new Sequelize(DATABASE_URL, {
models: [path.join(__dirname, "/*.model.ts")],
});

3 changes: 1 addition & 2 deletions backend/typescript/models/simpleEntity.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Column, Model, Table, DataType } from "sequelize-typescript";

import { Letters } from "../types";
import { Letters } from "@/types";

@Table({ tableName: "simple_entities" })
export default class SimpleEntity extends Model {
Expand All @@ -19,4 +19,3 @@ export default class SimpleEntity extends Model {
@Column
bool_field!: boolean;
}

2 changes: 1 addition & 1 deletion backend/typescript/nodemailer.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodemailerConfig } from "./types";
import { NodemailerConfig } from "@/types";

const config: NodemailerConfig = {
service: "gmail",
Expand Down
2 changes: 1 addition & 1 deletion backend/typescript/nodemon.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ext": "ts,js,json",
"exec": "ts-node -r dotenv/config server"
"exec": "ts-node -r dotenv/config -r tsconfig-paths/register server"
}
Loading
Loading