-
Notifications
You must be signed in to change notification settings - Fork 3
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 #175 from sayinmehmet47/notification-by-service-wo…
…rkers-when-book-loaded feat: book uploading notification for users
- Loading branch information
Showing
56 changed files
with
639 additions
and
925 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
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
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
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,20 @@ | ||
import { IBook } from '../../models/Books'; | ||
|
||
export interface VolumeInfo { | ||
categories: string[]; | ||
} | ||
|
||
export interface Item { | ||
volumeInfo: VolumeInfo; | ||
} | ||
export interface BooksData { | ||
results: IBook[]; | ||
total: number; | ||
page: number; | ||
next?: { | ||
page: number; | ||
}; | ||
previous?: { | ||
page: number; | ||
}; | ||
} |
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,23 @@ | ||
import express, { Request, Response } from 'express'; | ||
import { User } from '../../models/User'; | ||
|
||
const router = express.Router(); | ||
|
||
router.post('/', async (req: Request, res: Response) => { | ||
const sub = req.body.subscription; | ||
const user = req.body.user; | ||
|
||
if (!sub || !user) { | ||
return res | ||
.status(400) | ||
.json({ message: 'Missing subscription information.' }); | ||
} | ||
|
||
User.findByIdAndUpdate(user._id, { | ||
$set: { subscription: sub }, | ||
}).catch((e) => console.error(e)); | ||
|
||
res.status(201).json({ message: 'Subscription added successfully.' }); | ||
}); | ||
|
||
module.exports = router; |
Oops, something went wrong.