address1 and 2 added in sales

master
Bhaskar 10 months ago
parent 178c59048e
commit 0f978d027f

@ -320,6 +320,8 @@ exports.addStore = async (request, reply) => {
state = null, state = null,
zip = null, zip = null,
country = null, country = null,
address1 = null,
address2 = null
} = profile; // Extract profile fields } = profile; // Extract profile fields
// Check if the phone is already registered // Check if the phone is already registered
@ -362,6 +364,8 @@ exports.addStore = async (request, reply) => {
state, state,
zip, zip,
country, country,
address1,
address2
}, },
longitude, longitude,
latitude, latitude,
@ -399,7 +403,7 @@ exports.addSales = async (request, reply) => {
updatedBy, updatedBy,
} = request.body; } = request.body;
const { firstName, lastName ,address,city,state,country,zip} = profile || {}; const { firstName, lastName ,address,city,state,country,zip,address1,address2} = profile || {};
const existingStore = await Sales.findOne({ phone }); const existingStore = await Sales.findOne({ phone });
if (existingStore) { if (existingStore) {
@ -427,6 +431,8 @@ exports.addSales = async (request, reply) => {
state, state,
country, country,
zip, zip,
address1,
address2,
...profile, ...profile,
}, },
createdBy, createdBy,
@ -541,6 +547,9 @@ exports.editSalesUser = async (request, reply) => {
existingSales.profile.state = profile.state || existingSales.profile.state; existingSales.profile.state = profile.state || existingSales.profile.state;
existingSales.profile.country = profile.country || existingSales.profile.country; existingSales.profile.country = profile.country || existingSales.profile.country;
existingSales.profile.zip = profile.zip || existingSales.profile.zip; existingSales.profile.zip = profile.zip || existingSales.profile.zip;
existingSales.profile.address1 = profile.address1 || existingSales.profile.address1;
existingSales.profile.address2 = profile.address2 || existingSales.profile.address2;
} }
@ -625,6 +634,9 @@ exports.editStore = async (request, reply) => {
existingStore.profile.state = profile.state || existingStore.profile.state; existingStore.profile.state = profile.state || existingStore.profile.state;
existingStore.profile.country = profile.country || existingStore.profile.country; existingStore.profile.country = profile.country || existingStore.profile.country;
existingStore.profile.zip = profile.zip || existingStore.profile.zip; existingStore.profile.zip = profile.zip || existingStore.profile.zip;
existingStore.profile.address1 = profile.address1 || existingStore.profile.address1;
existingStore.profile.address2 = profile.address2 || existingStore.profile.address2;
} }

@ -146,6 +146,8 @@ const installationschema = new mongoose.Schema({
contactNumber: { type: String, default: null }, contactNumber: { type: String, default: null },
alternativeContactNumber: { type: String, default: null }, alternativeContactNumber: { type: String, default: null },
store_address: { type: String, default: null }, store_address: { type: String, default: null },
address1: { type: String, default: null },
address2: { type: String, default: null },
city: { type: String, default: null }, city: { type: String, default: null },
state: { type: String, default: null }, state: { type: String, default: null },
country: { type: String, default: null }, country: { type: String, default: null },
@ -358,7 +360,8 @@ const salesSchema = new mongoose.Schema({
lastName: { type: String, default: null }, lastName: { type: String, default: null },
contactNumber: { type: String, default: null }, contactNumber: { type: String, default: null },
alternativeContactNumber: { type: String, default: null }, alternativeContactNumber: { type: String, default: null },
address: { type: String, default: null }, address1: { type: String, default: null },
address2: { type: String, default: null },
city: { type: String, default: null }, city: { type: String, default: null },
state: { type: String, default: null }, state: { type: String, default: null },
country: { type: String, default: null }, country: { type: String, default: null },

@ -125,6 +125,8 @@ fastify.post('/api/stores', {
contactNumber: { type: "string", default: null }, contactNumber: { type: "string", default: null },
alternativeContactNumber: { type: "string", default: null }, alternativeContactNumber: { type: "string", default: null },
store_address: { type: "string", default: null }, store_address: { type: "string", default: null },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
city: { type: "string", default: null }, city: { type: "string", default: null },
state: { type: "string", default: null }, state: { type: "string", default: null },
country: { type: "string", default: null }, country: { type: "string", default: null },
@ -170,6 +172,8 @@ fastify.post('/api/salesSignUp', {
state: { type: 'string', default: null }, state: { type: 'string', default: null },
zip: { type: 'string', default: null }, zip: { type: 'string', default: null },
country: { type: 'string', default: null }, country: { type: 'string', default: null },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
}, },
required: ["firstName", "lastName"] required: ["firstName", "lastName"]
} }
@ -296,6 +300,8 @@ fastify.put('/api/editSalesUser/:salesId', {
state: { type: 'string', default: null }, state: { type: 'string', default: null },
zip: { type: 'string', default: null }, zip: { type: 'string', default: null },
country: { type: 'string', default: null }, country: { type: 'string', default: null },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
}, },
} }
@ -343,6 +349,8 @@ fastify.put('/api/editStore/:storeId', {
state: { type: "string" }, state: { type: "string" },
country: { type: "string" }, country: { type: "string" },
zip: { type: "string" }, zip: { type: "string" },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
}, },
}, },
alternativeNumber: { type: "string" }, alternativeNumber: { type: "string" },

Loading…
Cancel
Save