Skip to content

Commit

Permalink
🤏 Experiment with Mikro ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdodo committed Dec 8, 2024
1 parent a72e748 commit e5f5d63
Show file tree
Hide file tree
Showing 25 changed files with 3,427 additions and 915 deletions.
3 changes: 2 additions & 1 deletion back/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ COPY --from=0 /autochess/back /autochess/back

WORKDIR /autochess/back
COPY . .
RUN npm run build
RUN npm run build
CMD npm run start
28 changes: 27 additions & 1 deletion back/main.ts
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
console.log("Hello");
import { initMikro } from "./utils/init-mikro";
import { initMongo } from "./utils/init-mongo";
import type { Queuer } from "core/types/queuer";
import { createDataMapper } from "./utils/create-data-mapper";
import type { Db } from "mongodb";
import type { MikroORM } from "@mikro-orm/core";

new Promise((resolve) => setTimeout(resolve, 1500)).then(async () => {
const db: Db = await initMongo();
const orm: MikroORM = await initMikro();

const queuer: Queuer = {
publicKey: "PublicKey",
nickname: "Nickname",
createdAt: new Date().toISOString(),
};

const dataMapper = createDataMapper(orm, db);
await dataMapper.createQueuer(queuer);
const queuers = await dataMapper.readQueuers();

if (!queuers) {
throw new Error("No queuers found !");
}

console.log("Success !");
});
Loading

0 comments on commit e5f5d63

Please sign in to comment.