Overview

AGEVoté v2 Backend

Two targets are available to lighten the compilation of secondary backends.

Primary Backend

# Dev build with
cargo b --features build-primary

# Set the env variables
cp .env.example .env && vim .env

# Run with
./target/debug/agevote-primary
# or
cargo r --features build-primary


# Prepare for CI-CD !!!
cargo sqlx prepare --database-url postgres://USERNAME:PASSWORD@ADDR:5432/agevote -- --features build-primary

Secondary Backend

# Dev build with
cargo b --bin agevote-secondary

# Set the env variables
cp .env.example .env && vim .env

# Run with
./target/debug/agevote-secondary
# or
cargo r --bin agevote-secondary

Remarks

# Build both
cargo b --all-features

CLI nerds corner

# Get all tickets
curl -H "Authorization: Bearer $JWT" -X GET 'http://kara:4000/tickets' | jq
curl -H "Authorization: Bearer $JWT" -X GET 'http://kara:4000/tickets?activated' | jq
curl -H "Authorization: Bearer $JWT" -X GET 'http://kara:4000/tickets?activated=false' | jq
curl -H "Authorization: Bearer $JWT" -X GET 'http://kara:4000/tickets?bound' | jq
curl -H "Authorization: Bearer $JWT" -X GET 'http://kara:4000/tickets?bound=false' | jq
curl -H "Authorization: Bearer $JWT" -X GET 'http://kara:4000/tickets?activated&bound' | jq

# Generate Tickets' PDF
wget --header="Authorization: Bearer $JWT" 'http://localhost:4000/tickets/tickets.pdf' --post-data='{"from":1,"to":300}'

# Manual binding
curl -H "Authorization: Bearer $JWT" -X POST 'http://kara:4000/tickets/1/bind'
curl -H "Authorization: Bearer $JWT" -X POST 'http://kara:4000/tickets/1/bind/324428'