Add full project files
This commit is contained in:
19
controllers/application/settings/settingsController.js
Normal file
19
controllers/application/settings/settingsController.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// controllers/settingController.js
|
||||
|
||||
const SettingModel = require('../../../models/SettingsModel')
|
||||
|
||||
// متد برای دریافت تنظیمات بر اساس key
|
||||
const getSetting = async (req, res, next) => {
|
||||
try {
|
||||
const { key } = req.params
|
||||
const setting = await SettingModel.findOne({ key })
|
||||
if (!setting) {
|
||||
return res.status(404).json({ message: 'تنظیمات مورد نظر یافت نشد' })
|
||||
}
|
||||
res.status(200).json(setting)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { getSetting }
|
||||
Reference in New Issue
Block a user