-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
4,901 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,35 @@ | ||
node_modules | ||
# compiled output | ||
/dist | ||
/node_modules | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { IsNotEmpty, IsNumber, IsString, Min, MinLength } from "class-validator"; | ||
|
||
export class CreateProductInterface { | ||
|
||
id: number; | ||
|
||
@IsNotEmpty() | ||
@IsString() | ||
@MinLength(5) | ||
name: string; | ||
image?: string; | ||
@IsNotEmpty() | ||
@IsNumber() | ||
@Min(0) | ||
qty: number; | ||
@IsNotEmpty() | ||
@IsString() | ||
price: string; | ||
@IsNotEmpty() | ||
@IsString() | ||
@MinLength(5) | ||
description?: string; | ||
rating?: string; | ||
reviews?: string[]; | ||
sold?: string; | ||
@IsNotEmpty() | ||
@IsString() | ||
@MinLength(2) | ||
sku?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ProductPricesInterface } from "./productPrices.interface"; | ||
import { StoreInterface } from "./store.interface"; | ||
|
||
export class ProductInterface { | ||
id: number; | ||
name: string; | ||
image?: string; | ||
store?:StoreInterface; | ||
qty?: number; | ||
price?:ProductPricesInterface; | ||
description?: string; | ||
rating?: string; | ||
reviews?: string[]; | ||
sold?: string; | ||
sku?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface ProductPricesInterface { | ||
id: number; | ||
productId: number; | ||
rawPrice: string; | ||
price: string; | ||
priceDollar: string; | ||
taxDollar: string; | ||
oldPrice: string; | ||
oldPriceDollar: string; | ||
discount: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class StoreInterface { | ||
id?: number; | ||
status?: number; | ||
name?: string; | ||
email?: string; | ||
logo?: string; | ||
link?: string; | ||
welcomeText?: string; | ||
category?: string; | ||
background?: string; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export enum RolesType { | ||
owner = 'owner', | ||
admin = 'admin', | ||
} | ||
|
||
export type UserRoleType = Record<string, Record<string, RolesType>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export class UserInterface { | ||
id?: number; | ||
firstName?: string; | ||
lastName?: string; | ||
isActive?: boolean; | ||
email: string; | ||
gender?: string; | ||
profilePic?: string; | ||
receiveNotification?: boolean; | ||
receiveMessage?: boolean; | ||
receivePromotionEmail?: boolean; | ||
receiveEmail?: boolean; | ||
roles?: string[]; | ||
store?: string; | ||
background?: string; | ||
token?: string; | ||
language?: string; | ||
city?: string; | ||
migrate?: string; | ||
transactions?: string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ValidationPipe } from '@nestjs/common'; | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './modules/app/app.module'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
// await app.listen(3000); | ||
app.enableCors({ | ||
origin: [ | ||
'https://lunnex-seller-kdqsn3cto-abjerry97.vercel.app', | ||
'https://lunnex-seller-git-main-abjerry97.vercel.app', | ||
'https://lunnex-seller-abjerry97.vercel.app', | ||
'https://lunnex-seller.vercel.app', | ||
'http://localhost:3001', | ||
'http://localhost:3000', | ||
], //or whatever port your frontend is using | ||
credentials: true, | ||
methods: ['GET', 'POST', 'PUT', 'DELETE'], | ||
// optionSuccessStatus:200 | ||
}); | ||
app.useGlobalPipes(new ValidationPipe( )); | ||
await app.listen(3000); | ||
} | ||
bootstrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { | ||
Entity, | ||
Column, | ||
ManyToOne, | ||
PrimaryGeneratedColumn, | ||
JoinColumn, | ||
OneToOne, | ||
} from 'typeorm'; | ||
import { ProductPrice } from '../productPrice/productPrice.entity'; | ||
import { Store } from '../store/store.entity'; | ||
|
||
@Entity() | ||
export class Product { | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@Column({ default: '' }) | ||
name?: string; | ||
|
||
// @Column({ default: null }) | ||
// @ManyToOne(() => Store, (store) => store.products) | ||
// store?: number; | ||
|
||
@Column({ default: '' }) | ||
image?: string; | ||
|
||
@Column({ default: 0 }) | ||
qty?: number; | ||
|
||
@Column({ default: 0 }) | ||
status?: number; | ||
|
||
@Column({ default: '' }) | ||
description?: string; | ||
|
||
@Column({ default: '0' }) | ||
rating?: string; | ||
|
||
// @Column() | ||
// reviews: string; | ||
@Column({ default: 0 }) | ||
sold?: number; | ||
|
||
@JoinColumn() | ||
@ManyToOne(() => Store, (store) => store.products) | ||
store?: Store; | ||
|
||
@Column({ default: '' }) | ||
sku?: string; | ||
|
||
// @Column({ type: 'timestamp', default: () => "CURRENT_TIMESTAMP"}) | ||
@Column({ default: null }) | ||
createdAt?: Date; | ||
|
||
// @Column({ type: 'timestamp', default: () => "CURRENT_TIMESTAMP"}) | ||
@Column({ default: null }) | ||
deletedAt?: Date; | ||
|
||
@OneToOne(() => ProductPrice, (price) => price.product) | ||
price?: ProductPrice; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn } from 'typeorm'; | ||
import { Product } from '../product/product.entity'; | ||
|
||
@Entity() | ||
export class ProductPrice { | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
// @Column({ default: "" }) | ||
@JoinColumn() | ||
@OneToOne(() => Product, (product) => product.price) | ||
product?: Product; | ||
|
||
@Column({ default: 10 }) | ||
status?: number; | ||
|
||
@Column({ default: '' }) | ||
rawPrice?: string; | ||
|
||
@Column({ default: '' }) | ||
price?: string; | ||
|
||
@Column({ default: '' }) | ||
priceDollar?: string; | ||
|
||
@Column({ default: '' }) | ||
taxDollar?: string; | ||
|
||
@Column({ default: '' }) | ||
oldPrice?: string; | ||
|
||
@Column({ default: '' }) | ||
oldPriceDollar?: string; | ||
|
||
@Column({ default: '' }) | ||
discount?: string; | ||
|
||
@Column({ default: true }) | ||
isActive?: boolean; | ||
|
||
@Column({ default: null }) | ||
createdAt?: Date; | ||
|
||
@Column({ default: null }) | ||
deletedAt?: Date; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
import { Entity, Column,OneToMany, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; | ||
import { Product } from '../product/product.entity'; | ||
import { User } from '../user/user.entity'; | ||
|
||
@Entity() | ||
export class Store{ | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
|
||
@ManyToOne(() => User, (user) => user.stores) | ||
user?: User; | ||
|
||
|
||
@Column({ default: 10 }) | ||
status?: number; | ||
|
||
@Column({ default: "" }) | ||
name: string; | ||
|
||
@Column({ default: "" }) | ||
email?: string; | ||
|
||
@Column({ default: "" }) | ||
link: string; | ||
|
||
@Column({ default: "" }) | ||
welcomeText?: string; | ||
|
||
@Column({ default: "" }) | ||
logo?: string; | ||
|
||
|
||
@Column({ default: "" }) | ||
category?: string; | ||
|
||
@Column({ default: "" }) | ||
background?: string; | ||
|
||
|
||
@OneToMany(() => Product, product => product.store) | ||
products: Product[]; | ||
|
||
@Column({ default: true }) | ||
isActive?: boolean; | ||
|
||
@Column({ type: 'timestamp', default: () => "CURRENT_TIMESTAMP"}) | ||
createdAt?: Date; | ||
|
||
@Column({ type: 'timestamp', default: () => "CURRENT_TIMESTAMP"}) | ||
deletedAt?: Date; | ||
} |
Oops, something went wrong.