Giter Site home page Giter Site logo

certificate-worker's People

Contributors

abhishek97 avatar heroichitesh avatar hitesshbajaj avatar jatinkatyal13 avatar manit1 avatar mohdimran001 avatar prabalsingh24 avatar prathambatra avatar tarunluthra123 avatar vdvibhu20 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

certificate-worker's Issues

Logout the user on 401 status code

Currently, the react fetches the user details from the jwt stored in the user's local storage of the browser. But even if the jwt is expired it reads and considers the user to be logged in and the API requests fail with 401.

ToDos

Frontend

  • On boot setTimeout on 60 minutes before jwt expiration to send a refresh token request, if the time is negative send request immediately
  • Write an axios request interceptor to logout the user when receiving 401 status code

Backend

  • Implement a hook in services/oneauth to refresh the jwt
    • jwt shouldn't have been expired for more than 7 days

No/Wrong instructions on sh into the container on readme.md

Overview

Following the readme.md on setting up the repo for development in my local machine, while sh-ing into the container using $ docker exec -it <container-id> /bin/sh doesn't work. The main cause for this is .env.sample which on yarn start produces an error and the container exits immediately with error code 1. The readme.md needs to be updated with the necessary instructions to build, run and debug the docker container on local environments.

Use puppeteer instead of phantomJS

Currently, the templates are rendered and converted to pdf using handlebars-pdf which internally uses phantomJS. PhantomJS has a lot of issues and is not consistent with how we see template on the browser hence we are moving to use puppeteer.

  • Create a folder src/utils/pdf
    • export a function that takes a HTML string and path as an argument and exports a PDF file to that path. You can refer this blog for how it can be implemented
  • Update src/index.js
    • Read the template specified in the data
    • Renders the template with the context using data
    • Pass the generated HTML string to the pdf util created above
  • run yarn start and in another terminal run node src/test.js
    • Check if the certificates are being generated in the src/certification folder.

Submission Guidelines

  • You can start working on this issue by forking and cloning the repository.
  • Before submission run the code on your system and check if everything is working normally
  • You can create a PR even before you are done with the implementation to gain help from the mentors
  • While creating PR make sure to copy all the todos above and mark all those which are done
  • Refrain from copying pasting the exact from the internet or other developers. Read the blog and stackoverflow code, understand it, try it out, test and then update the project

Pagination in Layouts List

Currently while displaying all the layouts in the collection are dumped. Introduce pagination on the backend and implement infinite scroll on the frontend

To start

Todo

Backend:

  • In src/services/layouts/handlers.js:GET introduce pagination using offset and limit parameter from query parameters
  • Write request validation for these query params in src/services/layouts/schema.js refer this

Frontend

  • In frontend/store/actions/layouts.js update loadLayouts() to accept an object as an argument with 2 keys offset and limit with default being 0 and 10.
  • In frontend/pages/layouts/index.js implement infinite scroll that'll just dispatch the action with incrementing offset

Use .env

Setup the project to use .env rather than config.json

We'll use the command

docker run -t -d certificate-worker --env-file=.env

to run the container

Fix: Dockerfile

Currently while building the docker image, every time we make a change to the source code it reinstalls all the node dependencies again.

You might find this article helpful while working on it.

Add search feature in layouts screen

Currently, the layouts page displays the api data directly but there is no option to search the layouts

ToDos

Frontend

  • Add Text Input on top of layout list in frontend/pages/layouts/index.js with onChange method that fires a search action
  • Update loadLayouts action to take another query parameter q with default value being an empty string.
  • After receiving search data unload all store data, so that only filtered data is displayed. Add a unloadAll flag in the action and replace the state rather than adding in the reducers based on this flag to avoid jank.

Backend

  • In src/services/layouts/handlers.js accept q in query params that searches the given query in layout titles. Also, add the q in schema

Improvement of setup docs in readme.md

In the readme.md file, the setup docs is as follows :

Setup locally

  • Firstly download and install rabbitmq-server on your system. See here
  • Create .env
  • Make sure rabbitmq-server is running (default port 5672)

Start server.

  • npm start
  • For testing.
  • npm test

Which for me are a little vague!

  • It is said, to create .env file, but what should be the configuration and should we include anything?
  • I tried copying the .env.sample file but it didn't work. While running the server it is giving errors
  • Steps to clone the repo and npm i is also not mentioned in the docs.

Errors :
image

Solution :

  • There should be a detailed explaination of methods to setup the enviornment locally

Add option to customize height and width of the certificate

Currently, the certificates generated have the fixed height and width of an A4 size paper. Users should be able to store height and width in pixels beside each layout.

To start

ToDo

Backend

  • In file src/services/layouts/schema.js change UPDATE and CREATE schema to accept height and width in the body
  • In file src/plugins/worker/handler.js:82 update the pdf document opts to use the height and width from the layout and use the current as default

Frontend

  • In file frontend/components/layouts/LayoutEditor.js update the component to incorporate height and width input.
  • Also change the ASPECT RATIO of the preview on the right when the user changes height and width.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.