environments changes
This commit is contained in:
@@ -36,7 +36,7 @@ services:
|
||||
image: mongo:latest
|
||||
container_name: mongo-Dwinzocontainer
|
||||
ports:
|
||||
- "27021:27021"
|
||||
- "27021:27017"
|
||||
volumes:
|
||||
- mongo-data:/data/db
|
||||
networks:
|
||||
|
||||
@@ -4,7 +4,7 @@ import environmentModel from "../../../shared/model/environments/environments-Mo
|
||||
export class environment {
|
||||
static async setEnvironment(req: Request, res: Response) {
|
||||
try {
|
||||
const { userId,roofVisibility,wallVisibility,shadowVisibity, organization } = req.body
|
||||
const { userId,roofVisibility,wallVisibility,shadowVisibility, organization } = req.body
|
||||
|
||||
|
||||
const findvalue = await environmentModel(organization).findOne({ userId: userId })
|
||||
@@ -12,12 +12,12 @@ export class environment {
|
||||
if (findvalue) {
|
||||
|
||||
const updatevalue = await environmentModel(organization).findOneAndUpdate(
|
||||
{ userId: userId }, { roofVisibility:roofVisibility,wallVisibility:wallVisibility,shadowVisibity:shadowVisibity}, { new: true });
|
||||
{ userId: userId }, { roofVisibility:roofVisibility,wallVisibility:wallVisibility,shadowVisibility:shadowVisibility}, { new: true });
|
||||
res.status(201).json(updatevalue);
|
||||
|
||||
|
||||
} else {
|
||||
const newValue = await environmentModel(organization).create({ userId, roofVisibility, wallVisibility,shadowVisibity });
|
||||
const newValue = await environmentModel(organization).create({ userId, roofVisibility, wallVisibility, });
|
||||
|
||||
|
||||
res.status(201).json(newValue);
|
||||
|
||||
@@ -12,7 +12,7 @@ const environmentSchema: Schema = new Schema({
|
||||
userId: { type: String, unique: true },
|
||||
roofVisibility: { type: Boolean ,default:false},
|
||||
wallVisibility: { type: Boolean ,default:false},
|
||||
shadowVisibity: { type: Boolean ,default:false},
|
||||
shadowVisibility: { type: Boolean ,default:false},
|
||||
});
|
||||
|
||||
// Model for MongoDB collection
|
||||
|
||||
Reference in New Issue
Block a user