The AI says services should be like this? But im confused about when these fields appeared in the DB? If this is the approach? I have to add calls here every time I add a new button or field to settings?
Surprised you can’t just set up settings page using the content-type-builder tbh
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::notifications.notifications', ({ strapi }) => ({
async getSettings() {
// Fetch the settings from the database...
// This is just a placeholder. You'll need to replace this with your actual implementation.
const settings = await strapi.query('settings', 'notifications').find();
return settings;
},
async updateSettings(data) {
// Update the settings in the database...
// This is just a placeholder. You'll need to replace this with your actual implementation.
const updatedSettings = await strapi.query('settings', 'notifications').update({ id: data.id }, data);
return updatedSettings;
},
}));```