Closed suhas-sensei closed 2 weeks ago
UserTask
src/endpoints/get_tasks.rs
calls: Option<Vec<String>>, contracts: Option<Vec<String>>, api_url: Option<String>, regex: Option<String>,
$project
"calls": 1, "contracts": 1, "api_url": 1, "regex": 1
# Connecting to MongoDB docker exec -it <container_id> mongosh
use admin db.auth("quests", "password")
db.quests.insertOne({ id: 1, name: "Starknet Introduction", disabled: false })
db.tasks.insertOne({ id: 1, quest_id: 1, name: "Deploy Your First Contract", href: "https://starknet.io/docs/hello_starknet/", cta: "Deploy Contract", verify_endpoint: "/verify/deploy", verify_endpoint_type: "default", verify_redirect: null, desc: "Learn to deploy your first Starknet smart contract", completed: [], quiz_name: null, calls: ["write_greeting", "get_greeting"], contracts: ["0x123456789"], api_url: "https://api.starknet.io/verify", regex: "^0x[a-fA-F0-9]{64}$", overwrite_order: 1 })
4. API Call ```powershell Invoke-WebRequest "http://localhost:8080/get_tasks?quest_id=1&addr=0x0000000000000000000000000000000000000000000000000000000000000000" | Select-Object -ExpandProperty Content | ConvertFrom-Json | ConvertTo-Json
{ "value": [{ "id": 1, "quest_id": 1, "name": "Deploy Your First Contract", "href": "https://starknet.io/docs/hello_starknet/", "cta": "Deploy Contract", "verify_endpoint": "/verify/deploy", "verify_endpoint_type": "default", "verify_redirect": null, "desc": "Learn to deploy your first Starknet smart contract", "completed": false, "quiz_name": null, "calls": ["write_greeting", "get_greeting"], "contracts": ["0x123456789"], "api_url": "https://api.starknet.io/verify", "regex": "^0x[a-fA-F0-9]{64}$" }], "Count": 1 }
fixes Add missing tasks fields #288
Changes
UserTask
struct insrc/endpoints/get_tasks.rs
:$project
stage includes the required fields :Authoring db in mongodb:
use admin db.auth("quests", "password")
Inserting test quest
db.quests.insertOne({ id: 1, name: "Starknet Introduction", disabled: false })
Inserting test task
db.tasks.insertOne({ id: 1, quest_id: 1, name: "Deploy Your First Contract", href: "https://starknet.io/docs/hello_starknet/", cta: "Deploy Contract", verify_endpoint: "/verify/deploy", verify_endpoint_type: "default", verify_redirect: null, desc: "Learn to deploy your first Starknet smart contract", completed: [], quiz_name: null, calls: ["write_greeting", "get_greeting"], contracts: ["0x123456789"], api_url: "https://api.starknet.io/verify", regex: "^0x[a-fA-F0-9]{64}$", overwrite_order: 1 })