You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
690 B
27 lines
690 B
import configService from '../services/config.service.js'; |
|
import typesError from '../error/types.error.js'; |
|
|
|
const getConfig = async (request, reply) => { |
|
try { |
|
const config = await configService.getConfig() |
|
return reply.code(200).send({ config: config.toJson() }) |
|
} catch (e) { |
|
return reply.code(500).send({ message: e.message }) |
|
} |
|
} |
|
|
|
const updateConfig = async (request, reply) => { |
|
const newConfig = request.body |
|
try { |
|
await configService.updateConfig(newConfig) |
|
return reply.code(200).send({ success: true }) |
|
} catch (e) { |
|
return reply.code(500).send({ message: typesError.TECHNICAL_UNKNOWN }) |
|
} |
|
} |
|
|
|
|
|
export default { |
|
getConfig, |
|
updateConfig |
|
}
|
|
|