environments changes
This commit is contained in:
@@ -36,15 +36,15 @@ services:
|
|||||||
image: mongo:latest
|
image: mongo:latest
|
||||||
container_name: mongo-Dwinzocontainer
|
container_name: mongo-Dwinzocontainer
|
||||||
ports:
|
ports:
|
||||||
- "27021:27017"
|
- "27021:27021"
|
||||||
volumes:
|
volumes:
|
||||||
- mongo-data:/data/db
|
- mongo-data:/data/db
|
||||||
networks:
|
networks:
|
||||||
- DwinzoMajor # Mongo is now on the same network
|
- DwinzoMajor # Mongo is now on the same network
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mongo-data: # Persistent volume for MongoDB data
|
mongo-data: # Persistent volume for MongoDB data
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
DwinzoMajor:
|
DwinzoMajor:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
@@ -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, organization } = req.body
|
const { userId,roofVisibility,wallVisibility,shadowVisibity, 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 }, { new: true });
|
{ userId: userId }, { roofVisibility:roofVisibility,wallVisibility:wallVisibility,shadowVisibity:shadowVisibity}, { new: true });
|
||||||
res.status(201).json(updatevalue);
|
res.status(201).json(updatevalue);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const newValue = await environmentModel(organization).create({ userId, roofVisibility, wallVisibility });
|
const newValue = await environmentModel(organization).create({ userId, roofVisibility, wallVisibility,shadowVisibity });
|
||||||
|
|
||||||
|
|
||||||
res.status(201).json(newValue);
|
res.status(201).json(newValue);
|
||||||
|
|||||||
@@ -12,6 +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},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Model for MongoDB collection
|
// Model for MongoDB collection
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export default async function mongoAdminCreation() {
|
|||||||
const uri = process.env.MONGO_URI!; // Replace with your MongoDB URI
|
const uri = process.env.MONGO_URI!; // Replace with your MongoDB URI
|
||||||
const client = new MongoClient(uri);
|
const client = new MongoClient(uri);
|
||||||
const user = {
|
const user = {
|
||||||
user: process.env.MONGO_USER!,
|
user:"admin",
|
||||||
pwd: process.env.MONGO_PASSWORD!,
|
pwd: process.env.MONGO_PASSWORD!,
|
||||||
roles: [{ role: "root", db: process.env.MONGO_AUTH_DB || "admin" }],
|
roles: [{ role: "root", db: process.env.MONGO_AUTH_DB || "admin" }],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user