-
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 #1 from MisterCxmpy/develop
see comment
- Loading branch information
Showing
12 changed files
with
299 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,29 +1,37 @@ | ||
const express = require('express'); | ||
const app = express() | ||
const cookieParser = require('cookie-parser') | ||
const cors = require('cors') | ||
|
||
const AuthRouter = require('./routes/AuthRouter') | ||
const TeamRouter = require('./routes/TeamRouter') | ||
const { validateToken } = require('./utils/validateToken'); | ||
|
||
app.use(express.json()) | ||
const AuthRouter = require('./routes/AuthRouter'); | ||
const TeamRouter = require('./routes/TeamRouter'); | ||
const UserRouter = require('./routes/UserRouter'); | ||
|
||
app.use(express.json()); | ||
app.use(cookieParser()); | ||
app.use(cors({ credentials: true })) // add your client domain in here like { origin: 'http://localhost:5172' } | ||
|
||
app.use('/auth', AuthRouter) | ||
app.use('/teams', TeamRouter) | ||
app.use('/teams', validateToken, TeamRouter) | ||
app.use('/me', validateToken, UserRouter) | ||
|
||
// currently can create teams and query teams for their associated members | ||
|
||
// need to: | ||
|
||
// add members to team | ||
// remove members from team | ||
|
||
// add tickets to backlog and assign them to members | ||
// add first, last name and email to the user model, concattinate both to create username | ||
|
||
// assign tickets to members | ||
// edit state of tickets and reassign them to new members | ||
|
||
// extract route logic to controllers | ||
// restrict access to services | ||
|
||
app.get('/', (req, res, next) => { | ||
res.json({ message: 'ok. api is working' }) | ||
}) | ||
|
||
module.exports = app; | ||
module.exports = app; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const router = require('express').Router(); | ||
const UserService = require('../services/UserService'); | ||
|
||
router.get('/teams', async (req, res) => { | ||
try { | ||
const teams = await UserService.getUserTeams(req.userId) | ||
|
||
res.json(teams.map(t => t.team_name)) | ||
} catch (error) { | ||
console.log(error) | ||
res.json({ message: error.message }) | ||
} | ||
}) | ||
|
||
|
||
module.exports = router; |
Oops, something went wrong.