Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin routes for custom_api tasks #266

Closed
4 tasks
Marchand-Nicolas opened this issue Sep 21, 2024 · 10 comments
Closed
4 tasks

Admin routes for custom_api tasks #266

Marchand-Nicolas opened this issue Sep 21, 2024 · 10 comments
Assignees
Labels
Good first issue Good for newcomers 🍒 Nice to have Nice to have but not a priority

Comments

@Marchand-Nicolas
Copy link
Collaborator

Description

Implement the necessary admin routes to create and edit a new custom_api task type.

PROPOSED TODO

  • Create a custom_api folder in src\endpoints\admin containing a create_custom_api and an update_custom_api route (such as in src\endpoints\admin\balance)
  • It should take a api_url (string) field and regex (string) field as arguments in the body (among the other default fields such as the task name), and store it in the task document in the db (as we are doing for other task types, such as in src\endpoints\admin\balance.)
  • Add the api_url (string) and regex (string) optional fields to the QuestTaskDocument type in src\models.rs if they are not already present.
  • The new document should look something like that:
    let new_document = QuestTaskDocument {
        name: body.name.clone(),
        desc: body.desc.clone(),
        verify_redirect: None,
        href: body.href.clone(),
        total_amount: None,
        quest_id: body.quest_id,
        id: next_id,
        cta: body.cta.clone(),
        verify_endpoint: "quests/verify_custom_api".to_string(),
        verify_endpoint_type: "default".to_string(),
        task_type: Some("custom_api".to_string()),
        discord_guild_id: None,
        quiz_name: None,
        contracts: None,
        api_url: Some(body.api_url),
        regex: Some(body.regex),
    };
@Marchand-Nicolas Marchand-Nicolas added 🍒 Nice to have Nice to have but not a priority Good first issue Good for newcomers OD Hack 8 labels Sep 21, 2024
@NueloSE
Copy link

NueloSE commented Sep 24, 2024

hi @Marchand-Nicolas kindly assign this task to me. it would be nice if i can make it my first contribution to this repo

Copy link

onlydustapp bot commented Sep 24, 2024

Hi @NueloSE!
Maintainers during the ODHack # 8.0 will be tracking applications via OnlyDust.
Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

@mubarak23
Copy link
Contributor

mubarak23 commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Experience Cairo smart contract developer with experience working on projects such as Just Art Peace, Dojo, Kart, TBA, and Shinigami. Before transitioning to Cairo development, I was a backend developer specializing in Rust.

My recent work with cairo starknet

My recent work with rust

How I plan on tackling this issue

I have read the description

This issue, am going to create two endpoints

  • CREATE CUSTOM TASK

    • collect the request body payload
    • validate the request body payload
    • make sure the payload contain api_url and regex
    • save the payload in the new db model for custom api TASK
    • if save fail, return the right error response
    • if save is successful, return successful response
  • EDIT CUSTOM API TASK

    • collect the id in the route param
    • collect the payload
    • fetch the custom api task, base on the ID
    • if the custom API TASK does not exist, resturn an error response
    • if the custom API TASK exist, validate the update payload and update the record
    • return error if update fail
    • return successful response if update operation was successful.

ETH: 16HRS

@PabloVillaplana
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Full Stack developer with 6 years of experience in the industry, I am super excited to be able to contribute to Web 3 projects, this to continue paving my way as an Open Source Contributor. I am from Dojo Coding Community

How I plan on tackling this issue

I would like to contribute again to Starknet Quest with this issue, I have to do a little research, but I would like to be able to contribute to this issue in Cairo, since it would help me a lot to be able to raise my level in Starknet.

@Dprof-in-tech
Copy link
Contributor

Dprof-in-tech commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, i am Dprof-in-tech, an experienced Full Stack Blockchain Developer and I am excited to contribute my skills to the {project name} project in this ODHACK 8. With a strong background in Next.js, TypeScript, JavaScript, React, Node.js, Rust and Cairo, I've honed my technical skills across the blockchain development landscape.
My journey with OnlyDust began at Edition 2, and I've since made 34 contributions across 11 projects. This extensive experience on the platform has allowed me to develop a keen understanding of delivering high-quality solutions under tight deadlines.
Due to my web2 experience, i am skilled in writing unit tests and have used Jest and Vitest to do this. I would love to contribute to this project by solving this issue.
Below is a link to my OnlyDust public profile.
https://app.onlydust.com/u/Dprof-in-tech

How I plan on tackling this issue

To solve this issue, i would :

  1. I’ll create a custom_api folder under the admin directory, with routes for create_custom_api and update_custom_api.

  2. The new task document will be updated to include the api_url and regex fields alongside existing fields like name, description, etc.

  3. I’ll also add these fields to the database schema, ensuring we store them correctly.

  4. The create route will allow creating tasks with the custom_api type, while the update route will handle modifying existing tasks.

  5. Finally, I’ll implement the necessary logic to interact with the database for task creation and updates, making sure the new fields are properly handled.

Once this is done, I’ll run tests to confirm everything is working as expected.

I’ll be sure to follow the guidelines as given and work to tender my solution as soon as possible.

@GoSTEAN
Copy link

GoSTEAN commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in backend development, specifically in creating and managing API routes using frameworks like Node.js, Rust, and TypeScript. I’ve worked on similar task management systems, where I handled database integration and ensured routes were properly set up to handle custom data. My familiarity with task-based APIs and database schemas will help me effectively implement and extend the custom API task type as required.

How I plan on tackling this issue

I would begin by creating the necessary folder and routes for create_custom_api and update_custom_api. Then, I’d add the api_url and regex fields to the request body and ensure they are correctly stored in the task document within the database. I’d update the QuestTaskDocument type to include these optional fields if they aren't already present. Finally, I would test the endpoints to ensure they function correctly with the new fields and integrate seamlessly with the existing API structure.

@GideonBature
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Software Engineer with experience in building a complete backend in Rust using RESTful API. I also have experience working with JavaScript and TypeScript.

How I plan on tackling this issue

First of all I will look at the code base and understand the structure, next I will look at other tasks type that are already present and implemented in the codebase to see the pattern used and know which kind of database that is used, this will guide me to know how I am going to structure my own code and implementation. Finally, I will add the api_url and the regexstring as fields in the already existing QuestTaskDocument struct.

Adding them as an option means they can either be present as value or None.

Copy link

onlydustapp bot commented Sep 26, 2024

The maintainer Marchand-Nicolas has assigned GideonBature to this issue via OnlyDust Platform.
Good luck!

@GideonBature
Copy link
Contributor

GideonBature commented Sep 26, 2024

Thank you @Marcmehand-Nicolas...

@Marchand-Nicolas
Copy link
Collaborator Author

Done here #272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Good for newcomers 🍒 Nice to have Nice to have but not a priority
Projects
None yet
Development

No branches or pull requests

7 participants