feat(FN-094): add comment line for deployment verification
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled

- Added a comment line to main.ts for deployment verification purposes
This commit is contained in:
Fusion
2026-05-11 02:07:03 +00:00
parent c72f063a25
commit f4fea1e429
274 changed files with 20712 additions and 6305 deletions

View File

@@ -1,12 +1,12 @@
import { Provider } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { drizzle, PostgresJsDatabase } from "drizzle-orm/postgres-js";
import { type PostgresJsDatabase, drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as core from "./schema/core";
import * as pl24 from "./schema/pl24";
import * as emex from "./schema/emex";
import * as relations from "./schema/relations";
import { isOtelEnabled } from "../telemetry";
import * as core from "./schema/core";
import * as emex from "./schema/emex";
import * as pl24 from "./schema/pl24";
import * as relations from "./schema/relations";
export const DATABASE = "DATABASE";
@@ -16,7 +16,8 @@ export type Database = PostgresJsDatabase<DatabaseSchema>;
export const DatabaseProvider: Provider = {
provide: DATABASE,
useFactory: (configService: ConfigService): Database => {
const databaseUrl = configService.get<string>("database.url")!;
const databaseUrl = configService.get<string>("database.url");
if (!databaseUrl) throw new Error("database.url is required");
const client = postgres(databaseUrl, {
max: 20,

View File

@@ -1,14 +1,15 @@
import {
boolean,
index,
integer,
jsonb,
numeric,
pgTable,
text,
timestamp,
uniqueIndex,
uuid,
varchar,
text,
boolean,
integer,
timestamp,
jsonb,
index,
uniqueIndex,
} from "drizzle-orm/pg-core";
// ─── Users ───────────────────────────────────────────
@@ -255,7 +256,11 @@ export const catalogVehicles = pgTable(
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),
},
(table) => [
uniqueIndex("catalog_vehicles_source_vid_idx").on(table.source, table.serviceVehicleId),
uniqueIndex("catalog_vehicles_source_svc_vid_idx").on(
table.source,
table.serviceName,
table.serviceVehicleId,
),
index("catalog_vehicles_brand_name_idx").on(table.brandName),
index("catalog_vehicles_service_name_idx").on(table.serviceName),
],
@@ -280,9 +285,7 @@ export const vehicles = pgTable(
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),
},
(table) => [
uniqueIndex("vehicles_vin_unique_idx").on(table.vin),
],
(table) => [uniqueIndex("vehicles_vin_unique_idx").on(table.vin)],
);
// ─── User Vehicles (junction — user ↔ shared vehicle) ─
@@ -311,7 +314,9 @@ export const categories = pgTable(
{
id: uuid("id").primaryKey().defaultRandom(),
vehicleId: uuid("vehicle_id").references(() => vehicles.id, { onDelete: "cascade" }),
catalogVehicleId: uuid("catalog_vehicle_id").references(() => catalogVehicles.id, { onDelete: "cascade" }),
catalogVehicleId: uuid("catalog_vehicle_id").references(() => catalogVehicles.id, {
onDelete: "cascade",
}),
name: varchar("name", { length: 500 }).notNull(),
nameOriginal: varchar("name_original", { length: 500 }),
parentId: uuid("parent_id"),
@@ -326,7 +331,12 @@ export const categories = pgTable(
index("categories_vehicle_id_idx").on(table.vehicleId),
index("categories_catalog_vehicle_id_idx").on(table.catalogVehicleId),
index("categories_parent_id_idx").on(table.parentId),
uniqueIndex("categories_vehicle_name_source_idx").on(table.vehicleId, table.catalogVehicleId, table.name, table.source),
uniqueIndex("categories_vehicle_name_source_idx").on(
table.vehicleId,
table.catalogVehicleId,
table.name,
table.source,
),
],
);
@@ -336,7 +346,9 @@ export const parts = pgTable(
{
id: uuid("id").primaryKey().defaultRandom(),
vehicleId: uuid("vehicle_id").references(() => vehicles.id, { onDelete: "cascade" }),
catalogVehicleId: uuid("catalog_vehicle_id").references(() => catalogVehicles.id, { onDelete: "cascade" }),
catalogVehicleId: uuid("catalog_vehicle_id").references(() => catalogVehicles.id, {
onDelete: "cascade",
}),
categoryId: uuid("category_id")
.notNull()
.references(() => categories.id, { onDelete: "cascade" }),
@@ -351,6 +363,8 @@ export const parts = pgTable(
remark: text("remark"),
modelCodes: varchar("model_codes", { length: 500 }),
presel: boolean("presel").default(false).notNull(),
price: numeric("price", { precision: 10, scale: 2 }),
currency: varchar("currency", { length: 3 }),
source: varchar("source", { length: 20 }).default("pl24").notNull(),
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
},

View File

@@ -1,14 +1,14 @@
import {
boolean,
index,
integer,
jsonb,
pgTable,
text,
timestamp,
uniqueIndex,
uuid,
varchar,
text,
boolean,
integer,
timestamp,
jsonb,
index,
uniqueIndex,
} from "drizzle-orm/pg-core";
// ─── EMEX Catalog ───────────────────────────────────
@@ -177,8 +177,7 @@ export const emexVehiclePartLinks = pgTable(
emexPartId: uuid("emex_part_id")
.references(() => emexParts.id, { onDelete: "cascade" })
.notNull(),
emexGroupId: uuid("emex_group_id")
.references(() => emexPartGroups.id, { onDelete: "cascade" }),
emexGroupId: uuid("emex_group_id").references(() => emexPartGroups.id, { onDelete: "cascade" }),
quantity: integer("quantity"),
position: varchar("position", { length: 100 }),
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),

View File

@@ -1,14 +1,14 @@
import {
boolean,
index,
jsonb,
pgTable,
serial,
text,
timestamp,
uniqueIndex,
uuid,
varchar,
text,
boolean,
serial,
timestamp,
jsonb,
index,
uniqueIndex,
} from "drizzle-orm/pg-core";
// ─── PCAT Vehicles — VIN decode results ────────────
@@ -59,9 +59,7 @@ export const pcatParts = pgTable(
description: text("description"),
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
},
(table) => [
index("pcat_parts_name_idx").on(table.name),
],
(table) => [index("pcat_parts_name_idx").on(table.name)],
);
// ─── PCAT Schema Pics — Schema images + hotspots ───
@@ -76,7 +74,5 @@ export const pcatSchemaPics = pgTable(
hotspots: jsonb("hotspots"), // positions array from API
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
},
(table) => [
index("pcat_schema_pics_group_car_idx").on(table.groupId, table.carId),
],
(table) => [index("pcat_schema_pics_group_car_idx").on(table.groupId, table.carId)],
);

View File

@@ -1,14 +1,14 @@
import {
boolean,
index,
integer,
jsonb,
pgTable,
text,
timestamp,
uniqueIndex,
uuid,
varchar,
text,
boolean,
integer,
timestamp,
jsonb,
index,
uniqueIndex,
} from "drizzle-orm/pg-core";
// ─── PL24 Catalog ───────────────────────────────────

View File

@@ -1,21 +1,21 @@
import { relations } from "drizzle-orm";
import {
users,
sessions,
accounts,
brands,
plans,
userSubscriptions,
userBrands,
payments,
queryLogs,
vehicles,
userVehicles,
catalogVehicles,
categories,
parts,
schemaPics,
payments,
plans,
queryLogs,
referrals,
catalogVehicles,
schemaPics,
sessions,
userBrands,
userSubscriptions,
userVehicles,
users,
vehicles,
} from "./core";
export const usersRelations = relations(users, ({ many }) => ({
@@ -96,7 +96,10 @@ export const userVehiclesRelations = relations(userVehicles, ({ one }) => ({
export const categoriesRelations = relations(categories, ({ one, many }) => ({
vehicle: one(vehicles, { fields: [categories.vehicleId], references: [vehicles.id] }),
catalogVehicle: one(catalogVehicles, { fields: [categories.catalogVehicleId], references: [catalogVehicles.id] }),
catalogVehicle: one(catalogVehicles, {
fields: [categories.catalogVehicleId],
references: [catalogVehicles.id],
}),
parent: one(categories, {
fields: [categories.parentId],
references: [categories.id],
@@ -109,7 +112,10 @@ export const categoriesRelations = relations(categories, ({ one, many }) => ({
export const partsRelations = relations(parts, ({ one }) => ({
vehicle: one(vehicles, { fields: [parts.vehicleId], references: [vehicles.id] }),
catalogVehicle: one(catalogVehicles, { fields: [parts.catalogVehicleId], references: [catalogVehicles.id] }),
catalogVehicle: one(catalogVehicles, {
fields: [parts.catalogVehicleId],
references: [catalogVehicles.id],
}),
category: one(categories, { fields: [parts.categoryId], references: [categories.id] }),
}));

View File

@@ -1,7 +1,7 @@
import "dotenv/config";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import { brands, plans, users, accounts } from "./schema/core";
import { accounts, brands, plans, users } from "./schema/core";
const BRANDS_DATA = [
// Mevcut markalar
@@ -76,7 +76,10 @@ async function seed() {
...p,
isActive: false,
}));
await db.insert(plans).values([...activePlans, ...trialPlans]).onConflictDoNothing();
await db
.insert(plans)
.values([...activePlans, ...trialPlans])
.onConflictDoNothing();
// Seed admin user
console.log("Seeding admin user...");