-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2378feb
commit e09af38
Showing
6 changed files
with
59 additions
and
8 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import * as express from "express"; | ||
import controller from "./controller"; | ||
import isLoggedIn from "../../middlewares/isLogged.handler"; | ||
|
||
export default express.Router().post("/:uid", controller.connect); | ||
export default express.Router().get("/:uid", isLoggedIn, controller.connect); |
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,27 @@ | ||
import mongoose from "mongoose"; | ||
const Link = require("../../models/link"); | ||
|
||
class InterviewService { | ||
async execute(link, user) { | ||
try { | ||
const isLink = await Link.findOne({ link }) | ||
.populate("interviewer") | ||
.populate("interviewee"); | ||
if (isLink) { | ||
if (user._id.toString() == isLink.interviewer.toString()) { | ||
return isLink; | ||
} else { | ||
} | ||
} else { | ||
throw { | ||
status: 404, | ||
message: "Invalid link", | ||
}; | ||
} | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
} | ||
|
||
export default new InterviewService(); |
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