Merge branch 'master' of ssh://85.143.175.152:222/bro-students/multy-stub

This commit is contained in:
RustamRu 2025-03-03 20:14:06 +03:00
commit 4f9434163e

View File

@ -156,17 +156,21 @@ router.post('/create', async (req, res, next) => {
router.get('/:id', async (req, res, next) => { router.get('/:id', async (req, res, next) => {
const { id } = req.params const { id } = req.params
if (!mongoose.Types.ObjectId.isValid(id)) { if (!mongoose.Types.ObjectId.isValid(id)) {
throw new Error(VALIDATION_MESSAGES.orderId.invalid) throw new Error(VALIDATION_MESSAGES.orderId.invalid)
} }
try { try {
const order = await OrderModel.findById(id) const order = await OrderModel.findById(id)
if (!order) { if (!order) {
throw new Error(VALIDATION_MESSAGES.order.notFound) throw new Error(VALIDATION_MESSAGES.order.notFound)
} }
res.status(200).send({ success: true, body: order }) const data = await OrderCarImgModel.findOne({ orderId: order.id }) || {}
res.status(200).send({ success: true, body: {...order,...data} })
} catch (error) { } catch (error) {
next(error) next(error)
} }
@ -277,7 +281,6 @@ const upload = multer({
const { v4: uuidv4 } = require("uuid") const { v4: uuidv4 } = require("uuid")
const axios = require('axios') const axios = require('axios')
const GIGA_CHAT_ACCESS_TOKEN = 'MTQwMmNmZjgtZjA5OC00OGMxLWI0OTUtNWU3ZTU4YzMzZjdjOmU5OGFiYmNiLThmMDItNGVmOC1hNjhhLTA4Y2QxYjVmOGRmMA=='
const GIGA_CHAT_OAUTH = 'https://ngw.devices.sberbank.ru:9443/api/v2/oauth' const GIGA_CHAT_OAUTH = 'https://ngw.devices.sberbank.ru:9443/api/v2/oauth'
const GIGA_CHAT_API = 'https://gigachat.devices.sberbank.ru/api/v1' const GIGA_CHAT_API = 'https://gigachat.devices.sberbank.ru/api/v1'
@ -416,7 +419,7 @@ router.post('/:id/upload-car-img', upload.single('file'), async (req, res) => {
image: convertFileToBase64(req.file), image: convertFileToBase64(req.file),
imageRating: value, imageRating: value,
imageDescription: description, imageDescription: description,
orderId, orderId: order.id,
created: new Date().toISOString(), created: new Date().toISOString(),
}) })