Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

207 investigate using mikroorm #209

Merged
merged 3 commits into from
Jul 22, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
# rm package-lock.json
- name: Install dependencies
run: npm install
- name: Typecheck
run: npm run typecheck
- name: Build Application
run: npm run build
- name: Generate PWA Assets
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
# rm package-lock.json
- name: Install dependencies
run: npm install
- name: Typecheck
run: npm run typecheck
- name: Build Application
run: npm run build
- name: Generate PWA Assets
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ logs
public/apple-touch-icon-*.png
public/favicon.ico
public/maskable-icon-*.png
public/pwa-*.png
public/pwa-*.png

# mikro-orm
temp
14 changes: 0 additions & 14 deletions middleware/slug-middleware.global.ts

This file was deleted.

52 changes: 52 additions & 0 deletions mikro-orm.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// This file is referenced by the application as well as the migration CLI
// The CLI use case requires the direct and indirect imports to have a .js extension.
// Additionally, the imports can not use '~'
import dotenv from "dotenv";
import { type Options, PostgreSqlDriver } from '@mikro-orm/postgresql';
import { TsMorphMetadataProvider } from '@mikro-orm/reflection';
import { Migrator } from '@mikro-orm/migrations';
import AssumptionSchema from "./server/data/models/AssumptionSchema.js";
import ConstraintSchema from "./server/data/models/ConstraintSchema.js";
import EffectSchema from "./server/data/models/EffectSchema.js";
import EnvironmentComponentSchema from "./server/data/models/EnvironmentComponentSchema.js";
import FunctionalBehaviorSchema from "./server/data/models/FunctionalBehaviorSchema.js";
import GlossaryTermSchema from "./server/data/models/GlossaryTermSchema.js";
import HintSchema from "./server/data/models/HintSchema.js";
import InvariantSchema from "./server/data/models/InvariantSchema.js";
import JustificationSchema from "./server/data/models/JustificationSchema.js";
import LimitSchema from "./server/data/models/LimitSchema.js";
import NonFunctionalBehaviorSchema from "./server/data/models/NonFunctionalBehaviorSchema.js";
import ObstacleSchema from "./server/data/models/ObstacleSchema.js";
import OutcomeSchema from "./server/data/models/OutcomeSchema.js";
import PersonSchema from "./server/data/models/PersonSchema.js";
import ProductSchema from "./server/data/models/ProductSchema.js";
import SolutionSchema from "./server/data/models/SolutionSchema.js";
import StakeholderSchema from "./server/data/models/StakeholderSchema.js";
import UseCaseSchema from "./server/data/models/UseCaseSchema.js";
import UserStorySchema from "./server/data/models/UserStorySchema.js";
import SystemComponentSchema from "./server/data/models/SystemComponentSchema.js";

dotenv.config();
const config: Options = {
extensions: [Migrator],
driver: PostgreSqlDriver,
dbName: process.env.POSTGRES_DB!,
user: process.env.POSTGRES_USER!,
host: process.env.POSTGRES_HOST!,
password: process.env.POSTGRES_PASSWORD!,
port: parseInt(process.env.POSTGRES_PORT!),
entities: [
AssumptionSchema, ConstraintSchema, EffectSchema, EnvironmentComponentSchema, FunctionalBehaviorSchema,
GlossaryTermSchema, HintSchema, InvariantSchema, JustificationSchema, LimitSchema, NonFunctionalBehaviorSchema,
ObstacleSchema, OutcomeSchema, PersonSchema, ProductSchema, SolutionSchema, StakeholderSchema, SystemComponentSchema,
UseCaseSchema, UserStorySchema
],
forceUtcTimezone: true,
metadataProvider: TsMorphMetadataProvider,
debug: process.env.NODE_ENV !== 'production',
migrations: {
transactional: true
}
};

export default config;
4 changes: 2 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-07-22',
devtools: {
enabled: process.env.NODE_ENV === 'development'
},
Expand Down Expand Up @@ -36,7 +37,6 @@ export default defineNuxtConfig({
// https://primeflex.org/
modules: ["nuxt-primevue", "@vite-pwa/nuxt"],
nitro: {
preset: 'node-server',
experimental: {
// https://nitro.unjs.io/config#openapi
openAPI: true
Expand Down Expand Up @@ -64,7 +64,7 @@ export default defineNuxtConfig({

},
typescript: {
typeCheck: false
typeCheck: true
},
vite: {

Expand Down
Loading
Loading