pvarki / python-rasenmaeher-api

1 stars 0 forks source link

enrollment add activate, deactivate and delete functionality. #40

Closed Aciid closed 12 months ago

Aciid commented 12 months ago

Add functionality to activate, deactivate and delete invite-codes

Aciid commented 12 months ago

Workflow:

Added activate column to management table, not checked anywhere yet.

Create invite-code for admin user_mnagement_hash, one from init or one that has been created.

curl --location 'http://localhost:8000/api/v1/enrollment/invitecode/create' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "user_management_hash": "TestikalukalukalukaulinJotainAsdJotainJotainJotain"
}'

Returns:

{
  "invite_code": "AP79VI9Q"
}

Check validiy for known invite-code

curl --location 'http://localhost:8000/api/v1/enrollment/invitecode?invitecode=AP79VI9Q' \
--header 'Accept: application/json'
{
  "invitecode_is_active": true
}

Activate known-invite-code ( modify active column to 1 )

curl --location --request PUT 'http://localhost:8000/api/v1/enrollment/invitecode/activate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "invite_code": "AP79VI9Q"
}'
{
  "invite_code": "AP79VI9Q"
}

Deactivate known invite-code ( modify active column to 0

curl --location --request PUT 'http://localhost:8000/api/v1/enrollment/invitecode/deactivate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "invite_code": "AP79VI9Q"
}'
{
  "invite_code": "AP79VI9Q"
}

Delete known invite-code

curl --location --request DELETE 'http://localhost:8000/api/v1/enrollment/invitecode/AP79VI9Q'

{
  "invite_code": "AP79VI9Q"
}
Aciid commented 12 months ago

API tests failing because they are skeleton.