This commit is contained in:
익희 김 2024-12-06 03:07:37 +09:00
parent bb24141d7c
commit 7a6fd2309b
5 changed files with 41 additions and 36 deletions

10
.env
View File

@ -1,14 +1,14 @@
MONGODB_URI="mongodb://localhost:27017/local" MONGODB_URI="mongodb://localhost:27017/local"
PORT=5100 PORT=5100
RECEIVING_EMAIL= # RECEIVING_EMAIL=
EMAIL_PASSWORD= # EMAIL_PASSWORD=
SHIPPING_FEE= # SHIPPING_FEE=
BASE_CURRENCY=KRW BASE_CURRENCY=KRW
STRIPE_SECRET_KEY= # STRIPE_SECRET_KEY=
CLOUDINARY_PUBLISHABLE_KEY="987548137488133" CLOUDINARY_PUBLISHABLE_KEY="987548137488133"
CLOUDINARY_SECRET_KEY="Juw0e7kSpWrI13K2lbbeDpbFD2Y" CLOUDINARY_SECRET_KEY="Juw0e7kSpWrI13K2lbbeDpbFD2Y"
CLOUDINARY_CLOUD_NAME="dmjztlmj4" CLOUDINARY_CLOUD_NAME="dmjztlmj4"
CURRENCY=KRW CURRENCY=KRW
# COMMISSION in percent # COMMISSION in percent
COMMISSION= # COMMISSION=
JWT_SECRET=picupjwtSecret JWT_SECRET=picupjwtSecret

View File

@ -13,7 +13,7 @@ const CategorySchema = new mongoose.Schema(
}, },
blurDataURL: { blurDataURL: {
type: String, type: String,
required: [true, 'image-blur-data-url-required-error'], required: [false, 'image-blur-data-url-required-error'],
}, },
}, },
name: { name: {
@ -28,12 +28,12 @@ const CategorySchema = new mongoose.Schema(
}, },
description: { description: {
type: String, type: String,
required: [true, 'Description is required.'], required: [false, 'Description is required.'],
maxlength: [500, 'Description cannot exceed 500 characters.'], maxlength: [500, 'Description cannot exceed 500 characters.'],
}, },
metaDescription: { metaDescription: {
type: String, type: String,
required: [true, 'Meta description is required.'], required: [false, 'Meta description is required.'],
maxlength: [200, 'Meta description cannot exceed 200 characters.'], maxlength: [200, 'Meta description cannot exceed 200 characters.'],
}, },
slug: { slug: {

View File

@ -23,12 +23,15 @@ const productSchema = new mongoose.Schema(
}, },
description: { description: {
type: String, type: String,
required: false
}, },
metaTitle: { metaTitle: {
type: String, type: String,
required: false
}, },
metaDescription: { metaDescription: {
type: String, type: String,
required: false
}, },
slug: { slug: {
type: String, type: String,
@ -46,19 +49,20 @@ const productSchema = new mongoose.Schema(
}, },
gender: { gender: {
type: String, type: String,
required: false
}, },
tags: [String], tags: [String],
sku: { sku: {
type: String, type: String,
required: [true, 'SKU is required.'], required: [false, 'SKU is required.'],
}, },
price: { price: {
type: Number, type: Number,
required: [true, 'Price is required.'], required: [false, 'Price is required.'],
}, },
priceSale: { priceSale: {
type: Number, type: Number,
required: [true, 'Sale price is required.'], required: [false, 'Sale price is required.'],
}, },
oldPriceSale: { oldPriceSale: {
type: Number, type: Number,
@ -87,15 +91,15 @@ const productSchema = new mongoose.Schema(
{ {
url: { url: {
type: String, type: String,
required: [true], required: [false],
}, },
_id: { _id: {
type: String, type: String,
required: [true], required: [false],
}, },
blurDataURL: { blurDataURL: {
type: String, type: String,
required: [true, 'image-blur-data-url-required-error'], required: [false, 'image-blur-data-url-required-error'],
}, },
}, },
], ],

View File

@ -10,29 +10,29 @@ const ShopSchema = new mongoose.Schema(
logo: { logo: {
_id: { _id: {
type: String, type: String,
required: [true, 'image-id-required-error'], required: [false, 'image-id-required-error'],
}, },
url: { url: {
type: String, type: String,
required: [true, 'image-url-required-error'], required: [false, 'image-url-required-error'],
}, },
blurDataURL: { blurDataURL: {
type: String, type: String,
required: [true, 'image-blur-data-url-required-error'], required: [false, 'image-blur-data-url-required-error'],
}, },
}, },
cover: { cover: {
_id: { _id: {
type: String, type: String,
required: [true, 'image-id-required-error'], required: [false, 'image-id-required-error'],
}, },
url: { url: {
type: String, type: String,
required: [true, 'image-url-required-error'], required: [false, 'image-url-required-error'],
}, },
blurDataURL: { blurDataURL: {
type: String, type: String,
required: [true, 'image-blur-data-url-required-error'], required: [false, 'image-blur-data-url-required-error'],
}, },
}, },
title: { title: {
@ -42,17 +42,17 @@ const ShopSchema = new mongoose.Schema(
}, },
metaTitle: { metaTitle: {
type: String, type: String,
required: [true, 'Meta title is required.'], required: [false, 'Meta title is required.'],
maxlength: [100, 'Meta title cannot exceed 100 characters.'], maxlength: [100, 'Meta title cannot exceed 100 characters.'],
}, },
description: { description: {
type: String, type: String,
required: [true, 'Description is required.'], required: [false, 'Description is required.'],
maxlength: [500, 'Description cannot exceed 500 characters.'], maxlength: [500, 'Description cannot exceed 500 characters.'],
}, },
metaDescription: { metaDescription: {
type: String, type: String,
required: [true, 'Meta description is required.'], required: [false, 'Meta description is required.'],
maxlength: [200, 'Meta description cannot exceed 200 characters.'], maxlength: [200, 'Meta description cannot exceed 200 characters.'],
}, },
slug: { slug: {
@ -70,7 +70,7 @@ const ShopSchema = new mongoose.Schema(
phone: { phone: {
type: String, type: String,
unique: true, unique: true,
required: true, required: false,
}, },
approved: { approved: {
type: Boolean, type: Boolean,
@ -108,26 +108,27 @@ const ShopSchema = new mongoose.Schema(
paymentInfo: { paymentInfo: {
holderName: { holderName: {
type: String, type: String,
required: true, // required: true,
required: false,
}, },
holderEmail: { holderEmail: {
type: String, type: String,
required: true, required: false,
}, },
bankName: { bankName: {
type: String, type: String,
required: true, required: false,
}, },
AccountNo: { AccountNo: {
type: Number, type: Number,
required: true, required: false,
}, },
}, },
address: { address: {
country: { type: String, required: true }, country: { type: String, required: false },
city: { type: String, required: true }, city: { type: String, required: false },
state: { type: String, required: true }, state: { type: String, required: false },
streetAddress: { type: String, required: true }, streetAddress: { type: String, required: false },
}, },
}, },
{ {

View File

@ -14,7 +14,7 @@ const SubCategorySchema = new mongoose.Schema(
}, },
blurDataURL: { blurDataURL: {
type: String, type: String,
required: [true, 'image-blur-data-url-required-error'], required: [false, 'image-blur-data-url-required-error'],
}, },
}, },
name: { name: {
@ -24,17 +24,17 @@ const SubCategorySchema = new mongoose.Schema(
}, },
metaTitle: { metaTitle: {
type: String, type: String,
required: [true, 'Meta Title is required.'], required: [false, 'Meta Title is required.'],
maxlength: [100, 'Meta Title cannot exceed 100 characters.'], maxlength: [100, 'Meta Title cannot exceed 100 characters.'],
}, },
description: { description: {
type: String, type: String,
required: [true, 'Description is required.'], required: [false, 'Description is required.'],
maxlength: [500, 'Description cannot exceed 500 characters.'], maxlength: [500, 'Description cannot exceed 500 characters.'],
}, },
metaDescription: { metaDescription: {
type: String, type: String,
required: [true, 'Meta Description is required.'], required: [false, 'Meta Description is required.'],
maxlength: [200, 'Meta Description cannot exceed 200 characters.'], maxlength: [200, 'Meta Description cannot exceed 200 characters.'],
}, },
slug: { slug: {