-
Notifications
You must be signed in to change notification settings - Fork 0
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 #5 from talafarael/delet-_notes
Delet notes
- Loading branch information
Showing
11 changed files
with
158 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"workbench.statusBar.visible": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { checkUserOwner } from "../type/middlewareType" | ||
|
||
|
||
async function checkUserOwner({res,user,_id}: checkUserOwner){ | ||
try{ | ||
const Owner = await user.ownAuction | ||
const checkOwner = Owner.find((auction: string) => auction == _id) | ||
if (!checkOwner) { | ||
return res.status(400).json({message: "You are not owner"}) | ||
} | ||
console.log('aaaa') | ||
console.log( checkOwner) | ||
return checkOwner | ||
} catch (error) { | ||
return res.status(401).json({ | ||
message: "Invalid token", | ||
}); | ||
} | ||
} | ||
|
||
|
||
module.exports = checkUserOwner |
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,9 @@ | ||
const jwt = require("jsonwebtoken") | ||
const {secret} = require("../config") | ||
const generateAccessToken = (id:string) => { | ||
const playold = { | ||
id, | ||
} | ||
return jwt.sign(playold, secret, {expiresIn: "24h"}) | ||
} | ||
exports.module=generateAccessToken |
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,8 @@ | ||
const {model, Schema} = require("mongoose") | ||
const AuctionDelete = new Schema({ | ||
idUser:{type:String}, | ||
id:{type:String}, | ||
password:{type:String} | ||
}, { timestamps: true }) | ||
AuctionDelete.index( { "createdAt": 1 }, { expireAfterSeconds: 420 } ); | ||
module.exports = model("AuctionDelete",AuctionDelete) |
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,28 @@ | ||
require('dotenv').config() | ||
const nodemailer=require('nodemailer') | ||
interface SendMessageParams { | ||
emailUser: string; | ||
password: string; | ||
} | ||
class passwordSendDelete { | ||
constructor() { | ||
this.transporter = nodemailer.createTransport({ | ||
service: 'gmail', | ||
auth: { | ||
user: "[email protected]", | ||
pass: "cmkvjfeqkrpqfyfz", | ||
} | ||
}); | ||
} | ||
|
||
|
||
async sendmessage({emailUser, password}: SendMessageParams): Promise<void>{ | ||
await this.transporter.sendMail({ | ||
from:"[email protected]", | ||
to:emailUser, | ||
text:password | ||
}) | ||
} | ||
} | ||
|
||
module.exports=passwordSendDelete |
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,7 @@ | ||
import { Response} from "express" | ||
import { IUser } from "./mongoType" | ||
export interface checkUserOwner{ | ||
res: Response, | ||
user:IUser, | ||
_id:string | ||
} |
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,9 @@ | ||
export interface IUser{ | ||
img: string, | ||
name: string, | ||
email: string, | ||
password: string, | ||
balance:Number, | ||
bidAuction:string[], | ||
ownAuction:[], | ||
} |