-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from wcmc-its/dev_v2_mrj4001
Fixed issues reported on wiki and integrated middleware for the redir…
- Loading branch information
Showing
13 changed files
with
332 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { response } from "express"; | ||
import type { NextApiRequest, NextApiResponse } from "next"; | ||
//import { Op, Sequelize, where,Transaction } from "sequelize"; | ||
import { Op, Sequelize } from "sequelize"; | ||
import models from "../../../src/db/sequelize"; | ||
import sequelize from "../../../src/db/db"; | ||
|
||
export const saveNotifications = async ( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) => { | ||
const { frequency, accepted, status, minimumThreshold, userId } = req.body; | ||
try { | ||
let createUserPayload = { | ||
'frequency': frequency, | ||
'accepted': accepted, | ||
'minimumThreshold1': minimumThreshold, | ||
'status': status, // Hardcoded 1 to make user active bydefault | ||
'userId': userId, | ||
'createTimestamp': new Date() | ||
} | ||
const result = await sequelize.transaction(async (t) => { | ||
const saveNotificationResp = await models.AdminNotificationPreference.create(createUserPayload, { transaction: t }) | ||
res.send(saveNotificationResp) | ||
}); | ||
} catch (e) { | ||
console.log(e); | ||
res.status(500).send(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.