UkraineNow-Intel / autoSA-backend

Django backend for autoSA
0 stars 1 forks source link

Create information interface for Sources #10

Closed j-bennet closed 2 years ago

j-bennet commented 2 years ago

Closes https://github.com/UkraineNow-Intel/autoSA-frontend/issues/4

First draft of Sources API. A few things still not finished:

This adds models for Sources and Translations. No locations yet.

Needs more work on unit test, but can be merged to unblock other things (such as https://github.com/UkraineNow-Intel/autoSA-django-backend/issues/1).

List:

curl -u admin:adminadmin --location --request GET 'http://localhost:8000/api/sources'

Create:

curl -u admin:adminadmin --location --request POST 'http://localhost:8000/api/sources' \
--data-raw '{
    "tags": [],
    "interface": "website",
    "source": "@Blah",
    "headline": "",
    "text": "Щось трапилося",
    "language": "ua",
    "timestamp": "2022-04-01T20:25:00Z",
    "pinned": "true",
    "translations": []
}'

Delete:

curl -u admin:adminadmin --location --request DELETE 'http://localhost:8000/api/sources/1'

cc @ barefoothiker

D0nPiano commented 2 years ago

Thank you @j-bennet, it looks great and will be very useful to further develop the frontend and the other tasks!

I just fixed two typos and an error that occured with the test (zoneinfo import error as I use python 3.8). Other than that everything (including the readme updates) looks perfect to me (I am really no Django expert though...)