Regression: Fix banners sync data types (#20517)

pull/20393/head^2
Diego Sampaio 4 years ago committed by GitHub
parent 6e3a36c8f0
commit 56f27dea0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      app/cloud/server/functions/syncWorkspace.js
  2. 2
      server/services/banner/service.ts

@ -63,15 +63,26 @@ export function syncWorkspace(reconnectCheck = false) {
Promise.await(NPS.create({
npsId,
startAt,
expireAt,
startAt: new Date(startAt),
expireAt: new Date(expireAt),
}));
}
// add banners
if (data.banners) {
for (const banner of data.banners) {
Promise.await(Banner.create(banner));
const {
createdAt,
expireAt,
startAt,
} = banner;
Promise.await(Banner.create({
...banner,
createdAt: new Date(createdAt),
expireAt: new Date(expireAt),
startAt: new Date(startAt),
}));
}
}

@ -46,8 +46,8 @@ export class BannerService extends ServiceClass implements IBannerService {
}
await this.Banners.insertOne({
_id: bannerId,
...doc,
_id: bannerId,
});
const banner = await this.Banners.findOneById(bannerId);

Loading…
Cancel
Save