Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User should be informed when books are overdue #33

Conversation

benfluleck
Copy link
Owner

Description

Users should be informed that books are overdue. This has been implemented through the client side and email notifications.

What does this PR do?

  • This PR implements changes to overdue books,
  • css styling changes to the UI
  • changes to loading of borrowed books
  • constructed an api route to borrow books
  • scheduler implemented to run daily to inform user of overdue books

Screenshots (if appropriate):

screen shot 2017-11-24 at 6 02 53 pm

screen shot 2017-11-24 at 5 34 09 pm

screen shot 2017-11-24 at 5 34 42 pm

Any background context you want to provide?

  • Cron job

What are the relevant pivotal tracker stories?

https://www.pivotaltracker.com/story/show/153101662

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • New chore (expected functionality to be implemented)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Benny Ogidan added 6 commits November 22, 2017 20:39
- Eslint changes to the updated files
-Changes to the loading of the borrowed books
- api route constructed for overdue books
- If the return date has passed then the user  can retrieve a list of the books
- Users can now see books that thet have not returned on time

- Users can return books from the Overdue books interface.
- Users are inform by email when they have overdue books with the title of the book.

- Scheduler to send email daily to inform the user on their overdue books.

[Delivers #153101662]

- Changes to schedule

fix (Clear cache): Cache cleared
- DS_Store and vscode removed

Router.get('/users/borrowedbooks', authdecodeToken, UserBooksController.getborrowedBooklist);
Router.get('/users/getoverduebooks', authdecodeToken, UserBooksController.getOverdueBooks)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon semi

bcc,
subject,
html,
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 0 spaces but found 2 indent

to,
bcc,
subject,
html,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

from: 'Mailer from library.com',
to,
bcc,
subject,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

export const mailOptions = (to, bcc, subject, html) => ({
from: 'Mailer from library.com',
to,
bcc,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

service: 'gmail',
auth: {
user: process.env.EMAIL_ADDRESS,
pass: process.env.EMAIL_PASSWORD

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent

export const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.EMAIL_ADDRESS,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 6 indent


export const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

require('dotenv').config();

export const transporter = nodemailer.createTransport({
service: 'gmail',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 4 indent

import nodemailer from 'nodemailer';
require('dotenv').config();

export const transporter = nodemailer.createTransport({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 0 spaces but found 2 indent

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.08%) to 86.572% when pulling 8d3078a on feature/152838944/user-should-be-informed-when-books-are-overdue into 7783e22 on development.

numberOfRecords={this.state.limit}
fetch={this.props.fetchAllBooksbyId}
/>
</div>);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected closing tag to match indentation of opening react/jsx-closing-tag-location

fetch={this.props.fetchAllBooksbyId}/>

</div>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing spaces not allowed no-trailing-spaces

/>
);
});
const getAllBooks = this.props.borrowedBooks.books.map(book => (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'borrowedBooks.books.map' is missing in props validation react/prop-types

import Book from '../../presentation/common/book/DisplayBook.jsx';
import { Preloader, Row, Col } from 'react-materialize';
import PaginationWrapper from '../common/Pagination.jsx';
import Book from '../../presentation/common/book/DisplayBook.jsx';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module '../../presentation/common/book/DisplayBook.jsx' import/no-unresolved
Unexpected use of file extension "jsx" for "../../presentation/common/book/DisplayBook.jsx" import/extensions

import PaginationWrapper from '../common/Pagination.jsx'
import Book from '../../presentation/common/book/DisplayBook.jsx';
import { Preloader, Row, Col } from 'react-materialize';
import PaginationWrapper from '../common/Pagination.jsx';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected use of file extension "jsx" for "../common/Pagination.jsx" import/extensions
Unable to resolve path to module '../common/Pagination.jsx' import/no-unresolved

* @returns {object} component
*/
render() {
if (!this.props.overdueBooks || this.props.overdueBooks.books.length === 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'overdueBooks' is missing in props validation react/prop-types
'overdueBooks.books' is missing in props validation react/prop-types
'overdueBooks.books.length' is missing in props validation react/prop-types

<div className="pre-loader">
{this.state.isLoading && <Preloader size="big" />}
</div>;
this.props.fetchOverdueBookstoDashboard (this.state.offset, this.state.limit);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'fetchOverdueBookstoDashboard' is missing in props validation react/prop-types
Unexpected space between function name and paren no-spaced-func
Unexpected space between function name and paren func-call-spacing
Irregular whitespace not allowed no-irregular-whitespace

* @returns {void}
*/
componentDidMount() {
<div className="pre-loader">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression no-unused-expressions

* @extends {Component}
*/
class DisplayOverdueBooks extends React.Component {
constructor(props) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing JSDoc comment require-jsdoc

import PaginationWrapper from '../common/Pagination.jsx';
import Book from '../../presentation/common/book/DisplayBook.jsx';
import { fetchOverdueBookstoDashboard } from '../../../actions/fetchbooks';
import MessageforNoOverdueBooks from '../../presentation/messages/dashboardMessages/MessageforNoOverdueBooks.jsx';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected use of file extension "jsx" for "../../presentation/messages/dashboardMessages/MessageforNoOverdueBooks.jsx" import/extensions
Unable to resolve path to module '../../presentation/messages/dashboardMessages/MessageforNoOverdueBooks.jsx' import/no-unresolved

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.08%) to 86.572% when pulling 2bcd592 on feature/152838944/user-should-be-informed-when-books-are-overdue into 7783e22 on development.

fixed coverage score by implementing exclude bloack for nyc
@@ -0,0 +1,14 @@
import nodemailer from 'nodemailer';
require('dotenv').config();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'dotenv' import/no-unresolved

@@ -0,0 +1,14 @@
import nodemailer from 'nodemailer';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected empty line after import statement not followed by another import import/newline-after-import
Unable to resolve path to module 'nodemailer' import/no-unresolved
Missing file extension for "nodemailer" import/extensions

.catch((error) => {
process.stdout.write(error.stack);
process.exit(0);
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 0 indent

})
.catch((error) => {
process.stdout.write(error.stack);
process.exit(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

});
})
.catch((error) => {
process.stdout.write(error.stack);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent
Trailing spaces not allowed no-trailing-spaces

emails.forEach((email,index) => {
const to = email;
const bcc = null;
const subject = "Default on Returning Book";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strings must use singlequote quotes

bookTitles.push(book.book.title);
});

emails.forEach((email,index) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A space is required after ',' comma-spacing

where: {
returnstatus: false,
returndate: {
$lt: Date.now() - 24 * 1000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected mix of '-' and '*' no-mixed-operators

@@ -0,0 +1,63 @@
import moment from 'moment';
import model from '../models';
import { transporter, mailOptions } from '../mailer/mailer';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module '../mailer/mailer' import/no-unresolved
Missing file extension for "../mailer/mailer" import/extensions

@@ -0,0 +1,63 @@
import moment from 'moment';
import model from '../models';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module '../models' import/no-unresolved
Missing file extension for "../models" import/extensions

@@ -0,0 +1,14 @@
import nodemailer from 'nodemailer';
require('dotenv').config();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module 'dotenv' import/no-unresolved

@@ -0,0 +1,14 @@
import nodemailer from 'nodemailer';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected empty line after import statement not followed by another import import/newline-after-import
Unable to resolve path to module 'nodemailer' import/no-unresolved
Missing file extension for "nodemailer" import/extensions

.catch((error) => {
process.stdout.write(error.stack);
process.exit(0);
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 2 spaces but found 0 indent

})
.catch((error) => {
process.stdout.write(error.stack);
process.exit(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent

});
})
.catch((error) => {
process.stdout.write(error.stack);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 4 spaces but found 2 indent
Trailing spaces not allowed no-trailing-spaces

emails.forEach((email,index) => {
const to = email;
const bcc = null;
const subject = "Default on Returning Book";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strings must use singlequote quotes

bookTitles.push(book.book.title);
});

emails.forEach((email,index) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A space is required after ',' comma-spacing

where: {
returnstatus: false,
returndate: {
$lt: Date.now() - 24 * 1000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected mix of '-' and '*' no-mixed-operators

@@ -0,0 +1,63 @@
import moment from 'moment';
import model from '../models';
import { transporter, mailOptions } from '../mailer/mailer';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module '../mailer/mailer' import/no-unresolved
Missing file extension for "../mailer/mailer" import/extensions

@@ -0,0 +1,63 @@
import moment from 'moment';
import model from '../models';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to resolve path to module '../models' import/no-unresolved
Missing file extension for "../models" import/extensions

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.8%) to 88.903% when pulling 0666589 on feature/152838944/user-should-be-informed-when-books-are-overdue into 7783e22 on development.

@benfluleck benfluleck merged commit 8bac566 into development Nov 24, 2017
@benfluleck benfluleck deleted the feature/152838944/user-should-be-informed-when-books-are-overdue branch December 13, 2017 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants