Git Product home page Git Product logo

web3-employment's People

Contributors

aditya-a-g avatar dependabot[bot] avatar gruz0 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

vayras

web3-employment's Issues

Move Batch Payment Validation Logic to Backend API

We would like to optimize the gas consumption during batch payment processing on the blockchain by moving the relevant logic from the smart contract to our backend API. The proposed solution involves creating a new endpoint, /api/blockchain/verify_batch_payment, which will accept a POST request with the following attributes in the request body:

  • groupId: The identifier of the group to which the user should have access.
  • recipients: An array of objects containing the following attributes for each recipient:
    • recipient_id: The identifier of the recipient.
    • payment_amount: The positive value of the payment amount.

The primary responsibility of this endpoint will be to validate the data that will be sent from the frontend to the blockchain. The validation process should include the following steps:

  1. Verify that the user making the request has access to the specified groupId.
  2. Verify that each recipient belongs to the specified groupId.
  3. Ensure that the payment_amount for each recipient is a positive value.

If all the validation checks pass, the endpoint should return a response with a status code of 200. In case of any validation failure, the endpoint should return a response with a status code of 422, along with an appropriate error explanation.

Create API endpoint for unarchiving companies

We need to create a new API endpoint for unarchiving companies in our system. The endpoint should be accessible at /api/companies/[id]/unarchive and should accept the POST HTTP method. The purpose of this endpoint is to set a company as active in our database.

Your task is to create the /api/companies/[id]/unarchive endpoint and implement the logic for unarchiving a company. If the company is already active, the endpoint should not do anything. The archived status of a company is stored as a timestamp in the archived_at column in the companies table.

If the company is archived (archived_at is not null), the endpoint should update the archived_at column in the companies table to the null.

The endpoint should return a HTTP 200 code, and a success message if the company is successfully unarchived, and an error message if there is an issue with the request (like company doesn't exist, for example).

Tests should be written to verify the functionality of the endpoint

Create frontend UI to display all companies

We need to add a new component called CompaniesList to the companies screen, which will display all the companies with their attributes.

You will need to fetch the companies from the API endpoint that you have already created and pass them into the CompaniesList component. Your task is to implement this functionality while adhering to the same code organization as the EmployeesList component.

Steps:

  1. Implement the CompaniesList component, which should be similar to the EmployeesList component, to display the attributes of each company.
  2. Integrate the CompaniesList component into the companies screen.
  3. Fetch companies data from the API endpoint that you have created and pass it into the CompaniesList component.
  4. Ensure that the code organization for the CompaniesList component matches that of the EmployeesList component.
  5. Test the CompaniesList component to ensure that it is displaying the companies and their attributes correctly.

Please take a look into employees list screen. I hope it will be helpful for you :-)

Implement Recipient List Import from CSV

As a frontend developer, your task is to implement a feature that allows users to upload their recipients list from a CSV file on a specific group page. Users should be able to upload the CSV file from their computer using a popup dialog triggered by an "Import" button.

The following steps outline the expected behavior of the feature:

  1. On the specific group page, a button labeled "Import" should be prominently displayed.
  2. When a user clicks the "Import" button, a popup dialog should appear, prompting them to select a CSV file from their computer.
  3. Upon submitting the file selection in the popup dialog, the frontend should send the CSV file to the backend through a specific API endpoint (POST /api/groups/:group_id/import).
  4. The backend API will then parse the uploaded CSV file, validate its contents, and reject any invalid records.
  5. After successful validation, the backend will insert the valid recipients into the specified group.
  6. The user should receive a confirmation message indicating that the import has been successful.

Validations to be applied to the CSV file are as follows:

  1. Records with empty wallet addresses should be skipped during import.
  2. If the payment amount is invalid (not a number or a negative number), the frontend should insert a value of 0 for that particular recipient.
  3. If a recipient's display name is empty, the frontend should use the associated wallet address in its place.
  4. All values, including wallet addresses, contacts, and display names, should be cleansed of any leading or trailing whitespaces.

Good luck with the implementation! If you encounter any challenges during the development process, don't hesitate to reach out for assistance. We look forward to seeing the successful integration of this essential feature into our platform.

We don't need to have `group_id` there, because batch payments relate to selected people, not a group. Instead we've to create a new table named `batch_payment_recipients` and set relation between `batch_payments_recipients.batch_payment_id` and `batch_payments.id`

          We don't need to have `group_id` there, because batch payments relate to selected people, not a group. Instead we've to create a new table named `batch_payment_recipients` and set relation between `batch_payments_recipients.batch_payment_id` and `batch_payments.id`

Originally posted by @gruz0 in #124 (comment)

Create API endpoint for archiving companies

We need to create a new API endpoint for archiving companies in our system. The endpoint should be accessible at /api/companies/[id] and should accept the DELETE HTTP method. The purpose of this endpoint is to set a company as archived in our database.

Your task is to create the /api/companies/[id] endpoint and implement the logic for archiving a company. If the company is already archived, the endpoint should not do anything (but return success response). The archived status of a company is stored as a timestamp in the archived_at column in the companies table.

If the company is not already archived (has a null in the column), the endpoint should update the archived_at column in the companies table to the current timestamp. If the company is already archived, the endpoint should not update the database.

The endpoint should return a HTTP 200 code, and a success message if the company is successfully archived, and an error message if there is an issue with the request (like company doesn't exist, for example).

Tests should be written to verify the functionality of the endpoint

Implement Recipient List Export to CSV

As a frontend developer, your next task is to implement a feature that allows users to export the recipients of a specific group from the database to a CSV file. The feature should be accessible through a button labeled "Export" on the group interface.

The following steps outline the expected behavior of the export feature:

  1. On the group interface, a button labeled "Export" should be visible to the user.
  2. When a user clicks the "Export" button, the frontend should send a request to the backend API endpoint: /api/groups/:group_id/export.
  3. The backend API should retrieve all entries from the recipients table associated with the specified group, including all fields for each recipient.
  4. The backend should then generate a CSV file containing the recipient data from the database.
  5. The CSV file should be sent as the output to the browser in response to the frontend request.
  6. The browser should initiate the download of the CSV file, allowing the user to save it to their computer.

Additionally, ensure that the exported CSV file includes all relevant recipient information, and each field is properly formatted to adhere to CSV standards.

Test the feature thoroughly to ensure it works smoothly and handles any potential edge cases gracefully.

Implement Saving of Batch Payment Transaction in Backend

Currently, our application saves individual payment transactions to the database, but it doesn't do the same for batch payments.
It's crucial that we also store batch payments in the database to have complete information about all transactions.

Expected Behavior:

When a batch payment is processed, the details of the transaction should be saved in the database, similarly to how individual payments are handled.To facilitate this, a new API endpoint should be created, like POST /api/groups/:id/batch_payment

Reference Links:

For the implementation of this feature, the following existing code can be referred to:

Create a new API endpoint that will allow users to list all available companies from the database

The task is to create a new API endpoint that will allow users to list all available companies from the database. The endpoint should be accessible through a GET request to /api/companies.

The endpoint should return a JSON response that includes a list of all available companies, along with their attributes. The attributes that should be included for each company are: id, display_name, comment, created_at, updated_at, and archived_at.

In addition, the API endpoint should be tested thoroughly to ensure that it works as expected. Test cases should cover scenarios such as when there are no companies in the database, and when there are companies in the database. When there are no companies in the database, the endpoint should return an empty array. When there are companies in the database, the endpoint should return an array of companies with all attributes.

By the end of the week, I expect to have successfully implemented the API endpoint and tested it thoroughly to ensure that it meets all requirements.

We should not list recipients without wallets.

          We should not list recipients without wallets.

There are two possible ways how to optimize such code:

  1. Implement new function on API side to return only recipients with non-empty wallet
  2. Filterize them on frontend side and keep getGroupById as it is right now

WDYT?

Originally posted by @gruz0 in #110 (comment)

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.