Skip to content

Commit

Permalink
EDF: [premieroctet#165] Ensure there is one admin dashboard in db
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien-Wappizy committed Dec 23, 2024
1 parent 75090c8 commit 8b9c336
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/web/server/plugins/entreprisedufutur/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const { computeUrl: ComputeDomain } = require('../../../config/config')
const { getTagUrl } = require('../../utils/mailing')
const { getterPartnerList } = require('./admin_dashboard')
const { getUnknownEmails, getInputsValid } = require('./order')
const AdminDashboard = require('../../models/AdminDashboard')

//Notification plugin setup
setAllowedTypes(NOTIFICATION_TYPES)
Expand Down Expand Up @@ -577,6 +578,16 @@ const ensureMarketScore = async () => {

ensureMarketScore()

const ensureAdminDashboard = async () => {
return AdminDashboard.findOneAndUpdate(
{},
{},
{upsert: true}
)
}

ensureAdminDashboard()

const preprocessGet = async ({model, fields, id, user, params}) => {
//console.log('preGet : model', model, 'fields', fields, 'id', id, 'user', user, 'params', params)
if (model=='loggedUser') {
Expand Down

0 comments on commit 8b9c336

Please sign in to comment.