codebooker icon indicating copy to clipboard operation
codebooker copied to clipboard

[Feature] Ability to add books via QR or Barcode

Open gbowne1 opened this issue 2 years ago • 13 comments

Some users may have already a lot of coding/programming books and to save time entering data may choose to use a reader, their phone or another device to save their books to the database instead of typing in the information.

gbowne1 avatar May 27 '23 19:05 gbowne1

I would recommend installing react-barcode-reader and using that library.

gbowne1 avatar Jun 20 '23 09:06 gbowne1

It appears we need to add:

react-barcode react-qr-code react-qr-reader

Libraries from npm for this function to work

gbowne1 avatar Jul 14 '23 09:07 gbowne1

Note: react-barcode-reader and react-qr-reader were added today.

gbowne1 avatar Jul 17 '23 22:07 gbowne1

hii @gbowne1

Some users may have already a lot of coding/programming books and to save time entering data may choose to use a reader, their phone or another device to save their books to the database instead of typing in the information.

Can you explain once again ..I am not clearly getting you

LOGESH-B avatar Jul 20 '23 09:07 LOGESH-B

@LOGESH-B Perhaps I will re write the issue so it is easier.

I added the react-barcode-reader npm package.

I think this is partly necessary in order for users to use a barcode scanner to scan the barcode on most programming books in order to put them in the database easily.

gbowne1 avatar Jul 21 '23 19:07 gbowne1

Hii @gbowne1 I scanned couple of books but it only gives the ISBN number not the things that we are needed(i.e name,author,year....) These things user needs to enter in the form himself.Only for ISBN number it is not a mandetory thing having Barcode reader In my point of view

I scanned books with Online Aspose barcode reader

LOGESH-B avatar Jul 22 '23 03:07 LOGESH-B

We would have to connect to an external data source (or another external API) in order for it to query the ISBN for more details. This is not something that needs to be implemented right away, but enough is working that it is indeed possible.

Barcodes on books are usually in the EAN format and yes, usually it is only the ISBN number.

I just saying for someone like me with over 300+ books on programming and coding it might be a bit difficult to enter in all the data for each book.

Before we can do all this we need the models, schemas, etc. for the books themselves so we don't have to rely on the json.

gbowne1 avatar Jul 22 '23 03:07 gbowne1

@LOGESH-B

this reminds me..

const mongoose = require('mongoose');

const bookSchema = new mongoose.Schema({
  title: { type: String, required: true },
  author: { type: String, required: true },
  description: { type: String },
  rating: { type: Number },
  reviews: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Review' }],
});

const Book = mongoose.model('Book', bookSchema);

module.exports = Book;

or...

const express = require('express');
const router = express.Router();
const Book = require('../models/book');

router.get('/books', async (req, res) => {
  try {
    const books = await Book.find();
    res.json(books);
  } catch (err) {
    console.error(err);
    res.status(500).json({ message: 'Server Error' });
  }
});

router.post('/books', async (req, res) => {
  const { title, author, description, rating } = req.body;

  try {
    const book = new Book({ title, author, description, rating });
    await book.save();
    res.json(book);
  } catch (err) {
    console.error(err);
    res.status(500).json({ message: 'Server Error' });
  }
});

module.exports = router;

gbowne1 avatar Jul 22 '23 03:07 gbowne1

@gbowne1 Assign to me i will work on that🙌

LOGESH-B avatar Jul 22 '23 04:07 LOGESH-B

I mean I can totally make that a new [TODO] issue to make the models for books like above. @LOGESH-B give me a few moments.

gbowne1 avatar Jul 22 '23 04:07 gbowne1

@gbowne1 Ok

LOGESH-B avatar Jul 22 '23 04:07 LOGESH-B

ok new issue added. Comment so I can assign.

gbowne1 avatar Jul 22 '23 04:07 gbowne1

@BlackBond06 This is the issue for adding books via barcode

gbowne1 avatar Aug 24 '23 20:08 gbowne1