Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
Co-authored-by: Borys Malinowski <borys-malinowski@users.noreply.github.com>
  • Loading branch information
KrzysztofZawisla and borys-malinowski committed Sep 3, 2023
1 parent 6a4536c commit 1020098
Show file tree
Hide file tree
Showing 47 changed files with 147 additions and 135 deletions.
1 change: 1 addition & 0 deletions bun.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import type Bun from "bun-types";
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
"license": "MIT",
"author": "KrzysztofZawisla <zawislakrzysztof.zk@gmail.com>, borys-malinowski <borys.malinowski@interia.pl>",
"scripts": {
"audit-dependencies": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/auditDependencies/auditDependencies.ts",
"build": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/build/build.ts --target server",
"build-docs": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/buildDocumentation/buildDocumentation.ts",
"check-dependencies": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/checkDependencies/checkDependencies.ts",
"depcheck": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/depcheck/depcheck.ts",
"dev": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/development/development.ts --target server",
"postinstall": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/postInstall/postInstall.ts",
"licence-checker": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/licenceChecker/licenceChecker.ts",
"lint": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/lint/lint.ts",
"remove-build": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/removeBuild/removeBuild.ts",
"start": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/run/run.ts --target server",
"audit-dependencies": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/auditDependencies/auditDependencies.ts",
"build": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/build/build.ts --target server",
"build-docs": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/buildDocumentation/buildDocumentation.ts",
"check-dependencies": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/checkDependencies/checkDependencies.ts",
"depcheck": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/depcheck/depcheck.ts",
"dev": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/development/development.ts --target server",
"postinstall": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/postInstall/postInstall.ts",
"licence-checker": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/licenceChecker/licenceChecker.ts",
"lint": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/lint/lint.ts",
"remove-build": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/removeBuild/removeBuild.ts",
"start": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/run/run.ts --target server",
"bun-start": "cross-env bun ./source/scripts/runner/commands/run/run.ts --target server",
"setup-husky": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/setupHusky/setupHusky.ts",
"setup-husky": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/setupHusky/setupHusky.ts",
"bun-setup-husky": "cross-env bun ./source/scripts/runner/commands/setupHusky/setupHusky.ts",
"test": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/runTests/runTests.ts",
"update-dependencies": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/updateDependencies/updateDependencies.ts",
"test": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/runTests/runTests.ts",
"update-dependencies": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/updateDependencies/updateDependencies.ts",
"build-and-start": "yarn run build && yarn run start",
"bun-build-and-bun-start": "bun run build && bun run start",
"generate-mongodb-types": "prisma generate --schema=./source/server/prisma/mongodb.prisma",
"generate-postgresql-types": "prisma generate --schema=./source/server/prisma/postgresql.prisma",
"migrate": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/migrate/migrate.ts",
"migrate-chromadb": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/migrateChromaDB/migrateChromaDB.ts",
"migrate": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/migrate/migrate.ts",
"migrate-chromadb": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/migrateChromaDB/migrateChromaDB.ts",
"storybook": "cross-env start-storybook -p 6006",
"generate-types": "cross-env TS_NODE_PROJECT=tsconfig.json ts-node ./source/scripts/runner/commands/generateTypes/generateTypes.ts",
"generate-types": "cross-env TS_NODE_PROJECT=tsconfig.node.json ts-node ./source/scripts/runner/commands/generateTypes/generateTypes.ts",
"bun-generate-types": "cross-env bun ./source/scripts/runner/commands/generateTypes/generateTypes.ts",
"documentation-start": "cd documentation && cross-env NODE_OPTIONS=--max-old-space-size=16384 docusaurus start",
"documentation-build": "cd documentation && docusaurus build",
Expand Down Expand Up @@ -424,7 +424,7 @@
"tslint": "^6.1.3",
"ttypescript": "^1.5.13",
"twilio": "^3.79.0",
"typescript": "^4.9.4",
"typescript": "^5.2.2",
"typescript-transform-paths": "^3.4.6",
"unused-webpack-plugin": "^2.4.0",
"url-loader": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion source/native-addon-go/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"sourceMap": true,
"alwaysStrict": true,
"module": "NodeNext",
"moduleResolution": "node",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"strictNullChecks": true,
"noImplicitAny": true,
Expand Down
2 changes: 1 addition & 1 deletion source/scripts/runner/commands/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ type BuildFlagsOptions = {
}build && cd .. && cd ..`;
const rustBuildPromise = $`cd ./${source}/native-addon-rust && ${Programs.CrossEnvironment} ${invokeYarnOrBunCommand} run build && cd .. && cd ..`;
await Promise.all([golangBuildPromise, rustBuildPromise]);
await $`${invokeYarnOrBunCommand} run ${scriptsKeys["remove-build"]} && ${Programs.CrossEnvironment} ${Programs.TypeScriptCompiler} --project tsconfig.noemit.json && ${Programs.CrossEnvironment} TS_NODE_PROJECT=tsconfig.json ${Programs.Webpack} --mode production --env target=${target}`;
await $`${invokeYarnOrBunCommand} run ${scriptsKeys["remove-build"]} && ${Programs.CrossEnvironment} ${Programs.TypeScriptCompiler} --project tsconfig.noemit.json && ${Programs.CrossEnvironment} TS_NODE_PROJECT=tsconfig.node.json ${Programs.Webpack} --mode production --env target=${target}`;
}
})();
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const umlFolderPath = join(process.cwd(), "uml");
$.prefix = "";
}
const invokeTsNodeOrBunCommand: string =
runtime === Runtime.Bun ? "bun" : "TS_NODE_PROJECT=tsconfig.json ts-node";
runtime === Runtime.Bun
? "bun"
: "TS_NODE_PROJECT=tsconfig.node.json ts-node";
const invokeYarnOrBunCommand: string =
runtime === Runtime.Bun ? "bun" : "yarn";
const generatePostgreSQLSchemaPromise = $`cross-env ${invokeTsNodeOrBunCommand} ./source/server/prisma/postgresql/index.ts`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const allergensOnProducts = createModel((allergensOnProductsModel) => {
.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.map("allergens_on_products")
.relation("allergens", productAllergensModel, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const contentItemModel: PrismaModel = createModel(
.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.relation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const contentItemsOnPostsAndSupbages = createModel(
ContentItemsOnPostsAndSupbagesModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.map("content_items_on_posts_and_subpages")
Expand Down
2 changes: 1 addition & 1 deletion source/server/prisma/mongodb/models/order/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const orderModel = createModel((OrderModel) => {
OrderModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", {
unique: true,
Expand Down
2 changes: 1 addition & 1 deletion source/server/prisma/mongodb/models/page/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const pageModel = createModel((pageModel) => {
.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.boolean("isDisabled", { map: "is_disabled" })
.string("name", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const model = createModel((PageCategoryModel) => {
PageCategoryModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.string("pageName", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const model = createModel((SubjectTranslationsModel) => {
SubjectTranslationsModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.enum("language", languagesEnum)
Expand Down
2 changes: 1 addition & 1 deletion source/server/prisma/mongodb/models/post/Post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const postModel = createModel((postModel) => {
.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", {
unique: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const model = createModel((PostTranslationsModel) => {
PostTranslationsModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.enum("language", languagesEnum)
Expand Down
2 changes: 1 addition & 1 deletion source/server/prisma/mongodb/models/product/Product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const productModel = createModel((ProductModel) => {
ProductModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", {
unique: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const productAllergensModel = createModel((ProductAllergensModel) => {
ProductAllergensModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", {
unique: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const model = createModel((ProductAllergensTranslationsModel) => {
ProductAllergensTranslationsModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.enum("language", languagesEnum)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const classModel = createModel((SchoolClassModel) => {
SchoolClassModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.relation("users", UsersModel, { list: true })
Expand Down
2 changes: 1 addition & 1 deletion source/server/prisma/mongodb/models/subject/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const subjectModel = createModel((SubjectModel) => {
SubjectModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.relation("subjectTranslations", SubjectTranslationsModel, { list: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const subjectsOnClasses = createModel((SubjectsOnClassesModel) => {
SubjectsOnClassesModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.map("subjects_on_classes")
.relation("subjects", SubjectModel, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const model = createModel((SubjectTranslationsModel) => {
SubjectTranslationsModel.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", { unique: true })
.enum("language", languagesEnum)
Expand Down
2 changes: 1 addition & 1 deletion source/server/prisma/mongodb/models/user/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const model: PrismaModel = createModel((UserModal: PrismaModel): void => {
UserModal.string("mongo_id", {
map: "_id",
id: true,
raw: /* prisma */ `@default(auto()) @database.ObjectId`,
raw: /* prisma */ `@default(auto()) @database.ObjectId`.trim(),
})
.int("id", {
unique: true,
Expand Down
36 changes: 18 additions & 18 deletions source/server/prisma/postgresql.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,24 @@ enum UserModifiers {
bannedReactingOnFeed
}

model ProductAllergensTranslations {
id Int @id @default(autoincrement())
language Languages
name String
allergenId Int @map("allergen_id")
allergenTranslation ProductAllergens @relation(fields: [allergenId], references: [id])
@@map("product_allergens_translations")
}

model ProductAllergens {
id Int @id @default(autoincrement())
allergensOnProducts AllergensOnProducts[]
productAllergenTranslations ProductAllergensTranslations[]
@@map("product_allergens")
}

model ContentItem {
id Int @id @default(autoincrement())
contentItemsOnPostsAndSubpages ContentItemsOnPostsAndSubpages[]
Expand Down Expand Up @@ -467,24 +485,6 @@ model Product {
@@map("products")
}

model ProductAllergensTranslations {
id Int @id @default(autoincrement())
language Languages
name String
allergenId Int @map("allergen_id")
allergenTranslation ProductAllergens @relation(fields: [allergenId], references: [id])
@@map("product_allergens_translations")
}

model ProductAllergens {
id Int @id @default(autoincrement())
allergensOnProducts AllergensOnProducts[]
productAllergenTranslations ProductAllergensTranslations[]
@@map("product_allergens")
}

model AllergensOnProducts {
allergens ProductAllergens @relation(fields: [allergenId], references: [id])
products Product @relation(fields: [productId], references: [id])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { PrismaModel } from "schemix";
import { createModel } from "schemix";
import schemixProductModel from "~backend/source/server/prisma/postgresql/models/product/product";
import schemixProductAllergensModel from "~backend/source/server/prisma/postgresql/models/productAllergens/ProductAllergens";
import schemixProductModel from "~frontend/../backend/source/server/prisma/postgresql/models/product/Product";

const schemixAllergensOnProductsModel: PrismaModel = createModel(
(schemixAllergensOnProductsModel: PrismaModel): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const schemixContentItemModel: PrismaModel = createModel(
id: true,
raw: /* prisma */ `
@default(autoincrement())
`,
`.trim(),
})
.relation(
"contentItemsOnPostsAndSubpages",
Expand All @@ -25,8 +25,8 @@ const schemixContentItemModel: PrismaModel = createModel(
})
.string("content", {
raw: /* prisma */ `
@database.Text
`,
@database.Text
`.trim(),
})
.map("content_items");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const schemixContentItemsOnPostsAndSubpagesModel: PrismaModel = createModel(
ContentItemsOnPostsAndSubpagesModel.int("id", {
id: true,
raw: /* prisma */ `
@default(autoincrement())
`,
@default(autoincrement())
`.trim(),
})
.map("content_items_on_posts_and_subpages")
.relation("posts", schemixPostModel, {
Expand Down
6 changes: 3 additions & 3 deletions source/server/prisma/postgresql/models/order/Order.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { PrismaModel } from "schemix";
import { createModel } from "schemix";
import schemixProductModel from "~backend/source/server/prisma/postgresql/models/product/product";
import schemixUserModel from "~backend/source/server/prisma/postgresql/models/user/User";
import schemixProductModel from "~frontend/../backend/source/server/prisma/postgresql/models/product/Product";

const schemixOrderModel: PrismaModel = createModel(
(OrderModel: PrismaModel): void => {
OrderModel.int("id", {
id: true,
raw: /* prisma */ `
@default(autoincrement())
`,
@default(autoincrement())
`.trim(),
})
.decimal("paymentAmount", {
map: "payment_amount",
Expand Down
12 changes: 6 additions & 6 deletions source/server/prisma/postgresql/models/post/Post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const schemixPostModel: PrismaModel = createModel(
.int("id", {
id: true,
raw: /* prisma */ `
@default(autoincrement())
`,
@default(autoincrement())
`.trim(),
})
.boolean("isDisabled", { map: "is_disabled" })
.enum("modifiers", schemixPostAndSubpageModifiersEnum, { list: true })
Expand All @@ -20,8 +20,8 @@ const schemixPostModel: PrismaModel = createModel(
})
.string("title", {
raw: /* prisma */ `
@database.VarChar(255)
`,
@database.VarChar(255)
`.trim(),
})
.relation(
"contentItemsOnPostsAndSubpages",
Expand All @@ -39,8 +39,8 @@ const schemixPostModel: PrismaModel = createModel(
})
.string("brief", {
raw: /* prisma */ `
@database.VarChar(255)
`,
@database.VarChar(255)
`.trim(),
})
.map("posts");
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const schemixPostTranslationModel: PrismaModel = createModel(
.int("id", {
id: true,
raw: /* prisma */ `
@default(autoincrement())
`,
@default(autoincrement())
`.trim(),
})
.enum("language", schemixLanguagesEnum)
.string("title")
Expand Down
Loading

0 comments on commit 1020098

Please sign in to comment.