201 lines
5.8 KiB
TypeScript
201 lines
5.8 KiB
TypeScript
import { PrismaService } from '../prisma/prisma.service';
|
|
import { Prisma } from '@prisma/client';
|
|
export declare class ProductService {
|
|
private prisma;
|
|
constructor(prisma: PrismaService);
|
|
getProduct(id: number): Promise<({
|
|
prices: ({
|
|
source: {
|
|
id: number;
|
|
name: string;
|
|
url: string;
|
|
logo: string | null;
|
|
lastScraped: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
};
|
|
} & {
|
|
id: number;
|
|
createdAt: Date;
|
|
sourceId: number;
|
|
regularPrice: number;
|
|
discountedPrice: number | null;
|
|
discountPercentage: number | null;
|
|
unitPrice: string | null;
|
|
promotionType: string | null;
|
|
promotionStart: Date | null;
|
|
promotionEnd: Date | null;
|
|
vatIncluded: boolean;
|
|
lastUpdated: Date;
|
|
productId: number;
|
|
})[];
|
|
} & {
|
|
id: number;
|
|
name: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
description: string | null;
|
|
category: string;
|
|
availability: boolean;
|
|
sourceProductId: string | null;
|
|
sourceId: number;
|
|
}) | null>;
|
|
getProducts(params: {
|
|
skip?: number;
|
|
take?: number;
|
|
cursor?: Prisma.ProductWhereUniqueInput;
|
|
where?: Prisma.ProductWhereInput;
|
|
orderBy?: Prisma.ProductOrderByWithRelationInput;
|
|
}): Promise<({
|
|
prices: ({
|
|
source: {
|
|
id: number;
|
|
name: string;
|
|
url: string;
|
|
logo: string | null;
|
|
lastScraped: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
};
|
|
} & {
|
|
id: number;
|
|
createdAt: Date;
|
|
sourceId: number;
|
|
regularPrice: number;
|
|
discountedPrice: number | null;
|
|
discountPercentage: number | null;
|
|
unitPrice: string | null;
|
|
promotionType: string | null;
|
|
promotionStart: Date | null;
|
|
promotionEnd: Date | null;
|
|
vatIncluded: boolean;
|
|
lastUpdated: Date;
|
|
productId: number;
|
|
})[];
|
|
} & {
|
|
id: number;
|
|
name: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
description: string | null;
|
|
category: string;
|
|
availability: boolean;
|
|
sourceProductId: string | null;
|
|
sourceId: number;
|
|
})[]>;
|
|
searchProducts(query: string): Promise<({
|
|
prices: ({
|
|
source: {
|
|
id: number;
|
|
name: string;
|
|
url: string;
|
|
logo: string | null;
|
|
lastScraped: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
};
|
|
} & {
|
|
id: number;
|
|
createdAt: Date;
|
|
sourceId: number;
|
|
regularPrice: number;
|
|
discountedPrice: number | null;
|
|
discountPercentage: number | null;
|
|
unitPrice: string | null;
|
|
promotionType: string | null;
|
|
promotionStart: Date | null;
|
|
promotionEnd: Date | null;
|
|
vatIncluded: boolean;
|
|
lastUpdated: Date;
|
|
productId: number;
|
|
})[];
|
|
} & {
|
|
id: number;
|
|
name: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
description: string | null;
|
|
category: string;
|
|
availability: boolean;
|
|
sourceProductId: string | null;
|
|
sourceId: number;
|
|
})[]>;
|
|
createProduct(data: Prisma.ProductCreateInput): Promise<{
|
|
prices: ({
|
|
source: {
|
|
id: number;
|
|
name: string;
|
|
url: string;
|
|
logo: string | null;
|
|
lastScraped: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
};
|
|
} & {
|
|
id: number;
|
|
createdAt: Date;
|
|
sourceId: number;
|
|
regularPrice: number;
|
|
discountedPrice: number | null;
|
|
discountPercentage: number | null;
|
|
unitPrice: string | null;
|
|
promotionType: string | null;
|
|
promotionStart: Date | null;
|
|
promotionEnd: Date | null;
|
|
vatIncluded: boolean;
|
|
lastUpdated: Date;
|
|
productId: number;
|
|
})[];
|
|
} & {
|
|
id: number;
|
|
name: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
description: string | null;
|
|
category: string;
|
|
availability: boolean;
|
|
sourceProductId: string | null;
|
|
sourceId: number;
|
|
}>;
|
|
updateProduct(params: {
|
|
where: Prisma.ProductWhereUniqueInput;
|
|
data: Prisma.ProductUpdateInput;
|
|
}): Promise<{
|
|
prices: ({
|
|
source: {
|
|
id: number;
|
|
name: string;
|
|
url: string;
|
|
logo: string | null;
|
|
lastScraped: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
};
|
|
} & {
|
|
id: number;
|
|
createdAt: Date;
|
|
sourceId: number;
|
|
regularPrice: number;
|
|
discountedPrice: number | null;
|
|
discountPercentage: number | null;
|
|
unitPrice: string | null;
|
|
promotionType: string | null;
|
|
promotionStart: Date | null;
|
|
promotionEnd: Date | null;
|
|
vatIncluded: boolean;
|
|
lastUpdated: Date;
|
|
productId: number;
|
|
})[];
|
|
} & {
|
|
id: number;
|
|
name: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
description: string | null;
|
|
category: string;
|
|
availability: boolean;
|
|
sourceProductId: string | null;
|
|
sourceId: number;
|
|
}>;
|
|
}
|