Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for Unique Seller Name #1

Open
mahendra785 opened this issue Aug 20, 2024 · 1 comment
Open

Check for Unique Seller Name #1

mahendra785 opened this issue Aug 20, 2024 · 1 comment

Comments

@mahendra785
Copy link
Collaborator

Ensure that when a new seller is registering, their name is unique. If the seller name is already taken, prevent the registration and show a message indicating that the seller name is unavailable.

@D-Vspec
Copy link
Collaborator

D-Vspec commented Aug 20, 2024

Check for Unique Seller Name

Objective

Ensure that when a new seller is registering, their name is unique. If the seller name is already taken, prevent the registration and show a message indicating that the seller name is unavailable.

Steps

1. Define the Seller Schema with a Unique Constraint

Mongoose Schema Example:

const mongoose = require('mongoose');

const sellerSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true,
        unique: true  // Ensure the name is unique in the database
    },
    email: {
        type: String,
        required: true,
        unique: true
    },
    // Add other fields as needed
});

const Seller = mongoose.model('Seller', sellerSchema);

module.exports = Seller;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants