jordanopensource / nuha-web

Web client for NUHA

Home Page:https://nuha.josa.ngo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upload file server functionality

thamudi opened this issue · comments

As an API I need the data which will be sent to me to be parsed into JSON.
The format I am looking for should follow this pattern:

[
 {
  "comment": "some comment here",
  "post": "the original post text",
 },
 {
  "comment": "some comment here",
  "post": "the original post text",
 },
 ... ,
 ... ,
 ... ,
]

Technical requirements:

  • Once the user uploads a file it needs to be validated that it follows the mentioned JSON structure.
  • If it doesn't match the user needs to be notified that it failed the validation check.
    • The user needs to be notified of what the error was. Example: expected a column named 'comment' found none.
  • If it passes the validation then the data will be parsed to JSON and sent over to the API. Don't worry about the API call for now.
  • Once the data has been sent, we need to handle request success/error.
    • If the request goes through and comes back with a proper response, the user will be notified.
    • If the request faces an error, the user will be notified of the request failing to process.

Issue Checklist:

  • Add a validator for the data file. It's advisable to transform the data to JSON first and check only the columns.
  • Add a JSON Parser.
  • Add a request handler.

NOTE: All request and processes responses should be properly reflected on the dashboad page as toast alerts.