Added settings for user data deletion
This commit is contained in:
parent
59e15cfde8
commit
f49490042a
35 changed files with 2758 additions and 499 deletions
6
backend/dist/middleware/auth.js
vendored
6
backend/dist/middleware/auth.js
vendored
|
|
@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.optionalAuth = exports.authenticate = void 0;
|
||||
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
||||
const index_js_1 = require("../index.js");
|
||||
const index_1 = require("../index");
|
||||
const JWT_SECRET = process.env.JWT_SECRET || 'treasure-trails-secret-key';
|
||||
const authenticate = async (req, res, next) => {
|
||||
try {
|
||||
|
|
@ -15,7 +15,7 @@ const authenticate = async (req, res, next) => {
|
|||
}
|
||||
const token = authHeader.split(' ')[1];
|
||||
const decoded = jsonwebtoken_1.default.verify(token, JWT_SECRET);
|
||||
const user = await index_js_1.prisma.user.findUnique({
|
||||
const user = await index_1.prisma.user.findUnique({
|
||||
where: { id: decoded.userId },
|
||||
select: { id: true, email: true, name: true }
|
||||
});
|
||||
|
|
@ -38,7 +38,7 @@ const optionalAuth = async (req, res, next) => {
|
|||
}
|
||||
const token = authHeader.split(' ')[1];
|
||||
const decoded = jsonwebtoken_1.default.verify(token, JWT_SECRET);
|
||||
const user = await index_js_1.prisma.user.findUnique({
|
||||
const user = await index_1.prisma.user.findUnique({
|
||||
where: { id: decoded.userId },
|
||||
select: { id: true, email: true, name: true }
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue