upd: api mobile
Deskripsi: - tambah project No Issues
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { title } from 'process';
|
||||||
import { DIR, funSendWebPush, funUploadFile, prisma } from "@/module/_global";
|
import { DIR, funSendWebPush, funUploadFile, prisma } from "@/module/_global";
|
||||||
import { funGetUserById } from "@/module/auth";
|
import { funGetUserById } from "@/module/auth";
|
||||||
import { createLogUserMobile } from "@/module/user";
|
import { createLogUserMobile } from "@/module/user";
|
||||||
@@ -179,13 +180,14 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
if (task.length > 0) {
|
if (task.length > 0) {
|
||||||
const dataProject = task.map((v: any) => ({
|
const dataProject = task.map((v: any) => ({
|
||||||
..._.omit(v, ["dateStart", "dateEnd", "name"]),
|
..._.omit(v, ["dateStart", "dateEnd", "name", "dateEndFix", "dateStartFix"]),
|
||||||
idProject: data.id,
|
idProject: data.id,
|
||||||
title: v.title,
|
title: v.title,
|
||||||
dateStart: new Date(v.dateStart),
|
dateStart: new Date(v.dateStartFix),
|
||||||
dateEnd: new Date(v.dateEnd),
|
dateEnd: new Date(v.dateEndFix),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
const insertTask = await prisma.projectTask.createMany({
|
const insertTask = await prisma.projectTask.createMany({
|
||||||
data: dataProject
|
data: dataProject
|
||||||
})
|
})
|
||||||
@@ -337,7 +339,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
const pushNotif = dataPush.filter((item) => item.subscription != undefined)
|
||||||
|
|
||||||
const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Kegiatan Baru', body: 'Terdapat kegiatan baru. Silahkan periksa detailnya.' } })
|
// const sendWebPush = await funSendWebPush({ sub: pushNotif, message: { title: 'Kegiatan Baru', body: 'Terdapat kegiatan baru. Silahkan periksa detailnya.' } })
|
||||||
const insertNotif = await prisma.notifications.createMany({
|
const insertNotif = await prisma.notifications.createMany({
|
||||||
data: dataNotif
|
data: dataNotif
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user