lfglabs-dev / api.starknet.quest

starknet.quest rust backend
7 stars 28 forks source link

New delete_question route #291

Closed Marchand-Nicolas closed 2 weeks ago

Marchand-Nicolas commented 3 weeks ago

Add a new route: src/endpoints/admin/quiz/delete_question.rs by reusing the code from src/endpoints/admin/quiz/update_question.rs which takes a question id as an argument, and delete it from the db

Snehagupta1907 commented 3 weeks ago

can i take up this issue?

ikemHood commented 2 weeks ago

Hello @Marchand-Nicolas, i would love to write the delete handler

The delete handler will

PoulavBhowmick03 commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Poulav Bhowmick, a Starknet Wolf. I am a software engineer at Invisible Studios, and a blockchain engineer with a robust background in TypeScript, Rust, Solidity Cairo, fullstack development and blockchain technology. My experience includes building robust applications, optimizing functionalities and blockchain integration. I have actively participated in events and open source contributions, enhancing my capability to tackle real-world tech challenges. My projects can be viewed on my GitHub Profile and OnlyDust Profile. Plus I´m active member of Starknet, Ethereum, Stellar ecosystem.

How I plan on tackling this issue

I will be reusing much of the structure from the update_question route to create the delete_question route. However, instead of updating the question, I will perform a deletion operation on the question identified by the id. I will also add a new route src/endpoints/admin/quiz/delete_question.rs. This route will accept a POST request and take a question_id as input, similar to the existing update route. I will use the same auth_middleware to ensure that only authorized users can delete a question. Instead of using the FindOneAndUpdateOptions, I will replace this with the delete_one operation to remove the question from the quiz_questions_collection. will also reuse the verify_quest_auth function to check if the user has permission to delete the question. and finally, will retrieve the associated quest_id by querying the tasks_collection just like in the update route.

ETA - 2 days

juandiegocv27 commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a software engineer with solid experience in Rust, which I’ve been using for a while now. I’ve completed the Rustlings course, so I’m pretty comfortable with the language. Recently, I've worked on projects like an HR web application for MAFISA where I led the development using FlutterFlow, and I’ve also contributed to open-source projects like Starknet Quest and ByteBeasts. These experiences have taught me a lot about full-stack development and working with teams. I've also used Rust with other technologies like Solana's SDK, so I'm confident I can contribute effectively to this project and I'm part of Dojo Coding Community.

How I plan on tackling this issue

I’d start by looking into the update_question.rs file to understand how the question ID is handled and the data is updated. Since the task involves reusing much of the same logic, I’d follow a similar structure for the delete_question.rs route, making sure the question is properly removed from the database. I’d also include checks to handle cases like invalid or non-existent IDs to avoid potential errors. After implementing the route, I’ll write a few tests to ensure everything works as expected and that no bugs appear.

ETA - 3/4 days

ikemHood commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello @Marchand-Nicolas, i would love to write the delete handler

The delete handler will

meetjn commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a blockchain developer intern at Quranium, skilled in Rust and Solidity. And I have been contributing to open-source projects since the start of this year.

How I plan on tackling this issue

I would approach this problem by going to the desired source code file "/admin/tasks/quiz/question/" and creating a "delete question" button with a parameter (question_id) adding the logic for removing a quest from db. How does this sound?

Ugo-X commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a Full Stack Blockchain Developer with demonstrable expertise across modern web and blockchain technologies. My tech stack centers on Next.js, TypeScript, React, and Node.js for web development, complemented by Three.js for 3D experiences, and Solidity/Rust for blockchain solutions.

What sets me apart is my proven track record on OnlyDust, where I've made 83 significant contributions across 15 different projects since Edition 1. This extensive involvement reflects my ability to deliver quality solutions under tight deadlines while adapting to diverse project requirements.

With my deep experience in hackathon environments, I bring both technical excellence and practical development skills to the table. I'm confident I can contribute meaningfully to pushing the boundaries of what's possible in blockchain development while maintaining a focus on user-centric solutions.

My profile (https://app.onlydust.com/u/Ugo-X) showcases my consistent ability to deliver results across various blockchain challenges. I'm excited to bring this experience and drive for innovation to your team.

How I plan on tackling this issue

I plan to implement the delete_question route in Rust as follows:

  1. Route Implementation: I’ll create the new endpoint in line with our existing structure.

  2. Database Operation: I’ll reuse the transaction pattern from update_question.rs, handle errors for non-existent questions, and implement cascade deletion if needed.

  3. Error Handling: I’ll specify error cases for question not found, permission denied, and database constraints, ensuring appropriate HTTP status codes.

  4. Testing: I’ll add integration tests for successful deletion, non-existent questions, permission checks, and transaction rollbacks.

I expect to complete this in one day.

Benjtalkshow commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Full Stack Developer specializing in Next.js, TypeScript, Node.js, Cairo and Rust . With over 31 contributions across projects in the OnlyDust ecosystem, I’ve developed strong proficiency in delivering high-quality solutions and resolving complex issues within tight deadlines. My experience spans frontend, backend, smart contracts, and the optimization and maintenance of scalable codebases.

How I plan on tackling this issue

I will implement a new delete_question route by creating the file src/endpoints/admin/quiz/delete_question.rs. This route will reuse much of the logic from src/endpoints/admin/quiz/update_question.rs. The route will accept a question ID as an argument and will proceed to delete the corresponding question from the database.

This approach ensures that the system can efficiently remove questions while maintaining consistent code structure. The route will handle any necessary validation to ensure the question exists before deletion, providing a clean and functional endpoint for managing quiz content.

Dprof-in-tech commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, I'm Dprof-in-tech, a seasoned Full Stack Blockchain Developer, and I'm excited to be part of ODHACK 9! I have a strong foundation in technologies such as Next.js, TypeScript, JavaScript, React, Node.js, Rust, and Cairo, I've built extensive experience across the blockchain development landscape.

I first got involved with OnlyDust during Edition 2, and since then, I've made 39 contributions across 11 different projects. Working on the platform has really helped me sharpen my skills, especially when it comes to delivering great solutions under tight deadlines. I love combining technical know-how with a user-focused approach, whether it's building immersive 3D experiences or crafting smart contracts that solve real-world problems.

Throughout, I've consistently demonstrated the ability to adapt and contribute effectively to diverse challenges. I'm confident in my ability to tackle new problems and drive innovation within the blockchain space. As we kick off ODHACK 9, I'm eager to apply my previous experience and technical expertise to push the boundaries of what's possible.

You can view my public profile on OnlyDust here: https://app.onlydust.com/u/Dprof-in-tech

How I plan on tackling this issue

Here's my approach to implementing the delete_question route in Rust:

  1. Route Implementation:

    • I'll create the new endpoint following our existing route structure
  2. Database Operation:

    • Reuse transaction pattern from update_question.rs
    • Add proper error handling for non-existent questions
    • Implement cascade deletion if needed
  3. Error Handling:

    • Add specific error cases for:
      • Question not found
      • Permission denied
      • Database constraints
    • Return appropriate HTTP status codes
  4. Testing:

    • Add integration tests:
      • Successful deletion
      • Non-existent question
      • Permission checks
      • Transaction rollback scenarios

Implementation Timeline: 1 day

SoarinSkySagar commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

GM @Marchand-Nicolas, I am Sagar Rana, a smart contract developer and full stack engineer. I have 3 years of experience building robust full stack applications and over a year of writing smart contracts. You can see my projects and contributions to some major repos on my GitHub profile. The tech stack I use mainly includes Solidity, Rust, JavaScript and Typescript. I am also contributing to the Starknet and Rust ecosystems and building on Cairo and Rust languages. I am interested in contributing to projects like this to learn more about these technologies and help make these projects better. Please assign me as I would be really glad to be a contributor in this project! :)

How I plan on tackling this issue

ETA: 3 Days

saimeunt commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a senior Full Stack Web3 Developer having contributed to several OD Hacks in the past.

How I plan on tackling this issue

I will create the route as described in the issue which is pretty self-explanatory.

0xdevcollins commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm Collins a frontend and blockchain developer, and an active contributor on OnlyDust. You can check out my profile here: https://app.onlydust.com/u/0xdevcollins.

How I plan on tackling this issue

I will begin by reusing the code from src/endpoints/admin/quiz/update_question.rs, which provides a solid foundation for handling request arguments and database interactions. I will create a new function in delete_question.rs that takes a question_id as an argument. This function will be responsible for deleting the specified question from the database.

Next, I will adapt the existing logic to replace the update functionality with a delete operation. This will involve modifying the database query to target the question specified by the question_id and executing the deletion. I will ensure proper error handling to manage cases where the question may not exist.

Once the deletion logic is in place, I will add the necessary route configuration in the application to ensure that the endpoint is accessible for DELETE requests. I will also include relevant documentation and comments to clarify the purpose of the route and its expected behavior.

I will test the new route to confirm that it correctly deletes questions from the database and handles edge cases appropriately.

aniruddhaaps commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a python dev . A new-comer here, willing and ready to contribute to solve the issue.

GideonBature commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

My name is Gideon Bature, a Software Engineer proficient in Rust, I have made some contributions in the last two ODHack with the last one being a Rust codebase in this same Starknet Quest.

How I plan on tackling this issue

I will add the new route src/endpoints/admin/quiz/delete_question.rs reusing the code from src/endpoints/admin/quiz/update_question.rs. After looking at the code in the update_question.rs, I am going to handle the handler function to add the question id as a parameter such that when it is being passed as an argument, it will query the database to find existing question with the question id, when it does, I will then use the delete method to remove it from the existing questions.