feat(FN-094): add comment line for deployment verification
Some checks failed
Sync dev → Gitea / Mirror dev to Gitea (push) Has been cancelled
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:
@@ -1,8 +1,8 @@
|
||||
import { Controller, Get, Post, Patch, Param, Body, UseGuards } from "@nestjs/common";
|
||||
import { BrandsService } from "./brands.service";
|
||||
import { Body, Controller, Get, Param, Patch, Post, UseGuards } from "@nestjs/common";
|
||||
import { Public } from "../common/decorators/public.decorator";
|
||||
import { Roles } from "../common/decorators/roles.decorator";
|
||||
import { RolesGuard } from "../common/guards/roles.guard";
|
||||
import { BrandsService } from "./brands.service";
|
||||
|
||||
@Controller("brands")
|
||||
export class BrandsController {
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { NotFoundException } from "@nestjs/common";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { BrandsService } from "./brands.service";
|
||||
|
||||
function createMockDb(overrides: Record<string, unknown> = {}) {
|
||||
function chainable(terminalValue: unknown) {
|
||||
const chain: Record<string, unknown> = {};
|
||||
const methods = [
|
||||
"select", "from", "where", "orderBy", "limit", "offset",
|
||||
"insert", "values", "update", "set", "returning",
|
||||
"select",
|
||||
"from",
|
||||
"where",
|
||||
"orderBy",
|
||||
"limit",
|
||||
"offset",
|
||||
"insert",
|
||||
"values",
|
||||
"update",
|
||||
"set",
|
||||
"returning",
|
||||
];
|
||||
for (const m of methods) chain[m] = vi.fn().mockReturnValue(chain);
|
||||
chain.limit = vi.fn().mockReturnValue(terminalValue);
|
||||
@@ -41,7 +50,10 @@ describe("BrandsService", () => {
|
||||
});
|
||||
|
||||
it("should return all brands when activeOnly is false", async () => {
|
||||
const brands = [{ id: "b1", name: "BMW" }, { id: "b2", name: "Audi" }];
|
||||
const brands = [
|
||||
{ id: "b1", name: "BMW" },
|
||||
{ id: "b2", name: "Audi" },
|
||||
];
|
||||
// When activeOnly=false, chain is: select().from().orderBy() — no where
|
||||
const chain: Record<string, any> = {
|
||||
from: vi.fn().mockReturnThis(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Inject, Injectable, NotFoundException } from "@nestjs/common";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { DATABASE, Database } from "../database/database.provider";
|
||||
import { DATABASE, type Database } from "../database/database.provider";
|
||||
import { brands } from "../database/schema/core";
|
||||
|
||||
@Injectable()
|
||||
@@ -30,7 +30,10 @@ export class BrandsService {
|
||||
return brand;
|
||||
}
|
||||
|
||||
async update(id: string, data: { name?: string; slug?: string; logoUrl?: string; isActive?: boolean }) {
|
||||
async update(
|
||||
id: string,
|
||||
data: { name?: string; slug?: string; logoUrl?: string; isActive?: boolean },
|
||||
) {
|
||||
const [brand] = await this.db
|
||||
.update(brands)
|
||||
.set({ ...data, updatedAt: new Date() })
|
||||
|
||||
Reference in New Issue
Block a user