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