import { Request, Response } from "express"; import userModel from "../../../shared/model/user-Model"; export class share { static async shareUser(req: Request, res: Response) { try { const { email, isShare, organization } = req.body const findValue = await userModel(organization).findOneAndUpdate({email:email},{isShare:isShare},{new:true}) res.status(201).json({message:"scene shared successfully",data:findValue}); if (!findValue) { res.status(404).json({message:"Not found"}) } // Send response with the created document } catch (error) { console.error('Error creating Share:', error); res.status(500).json({message:"Failed to create Share"}); } } static async findshareUser(req: Request, res: Response) { try { const organization = req.query.organization as string; const findValue = await userModel(organization).find({}).select("isShare email userName -_id") // console.log('findValue: ', findValue); res.status(201).json({message:"scene shared datas",data:findValue}); if (!findValue) { res.status(404).json({message:"Not found"}) } // Send response with the created document } catch (error) { console.error('Error Share:', error); res.status(500).json({message:"Failed to Share datas "}); } } }