Fix some bullshit
This commit is contained in:
@@ -90,11 +90,15 @@ func setupCollections(app core.App) error {
|
||||
itemsCollection.UpdateRule = types.Pointer("")
|
||||
itemsCollection.DeleteRule = types.Pointer("")
|
||||
|
||||
// Add fields
|
||||
// Add static fields only - no arbitrary fields allowed
|
||||
itemsCollection.Fields.Add(&core.TextField{
|
||||
Name: "content",
|
||||
Required: false,
|
||||
})
|
||||
itemsCollection.Fields.Add(&core.TextField{
|
||||
Name: "priority",
|
||||
Required: false,
|
||||
})
|
||||
itemsCollection.Fields.Add(&core.DateField{
|
||||
Name: "created_at",
|
||||
Required: false,
|
||||
|
10
test_api.sh
10
test_api.sh
@@ -16,13 +16,13 @@ echo
|
||||
echo "3. Create an item - single operation"
|
||||
curl -X PATCH "$BASE_URL/api/collections/shopping_items/items/test12345678901" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"op": "add", "path": "/content", "value": "My test item"}'
|
||||
-d "{\"op\": \"add\", \"path\": \"/content\", \"value\": \"My test item\"}"
|
||||
echo
|
||||
|
||||
echo "4. Update the item - single operation"
|
||||
curl -X PATCH "$BASE_URL/api/collections/shopping_items/items/test12345678901" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"op": "replace", "path": "/content", "value": "Updated test item"}'
|
||||
-d "{\"op\": \"replace\", \"path\": \"/content\", \"value\": \"Updated test item\"}"
|
||||
echo
|
||||
|
||||
echo "5. Get all items"
|
||||
@@ -32,19 +32,19 @@ echo
|
||||
echo "6. Add another field - single operation"
|
||||
curl -X PATCH "$BASE_URL/api/collections/shopping_items/items/test12345678901" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"op": "add", "path": "/priority", "value": "high"}'
|
||||
-d "{\"op\": \"add\", \"path\": \"/priority\", \"value\": \"high\"}"
|
||||
echo
|
||||
|
||||
echo "7. Remove a field - single operation"
|
||||
curl -X PATCH "$BASE_URL/api/collections/shopping_items/items/test12345678901" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"op": "remove", "path": "/priority"}'
|
||||
-d "{\"op\": \"remove\", \"path\": \"/priority\"}"
|
||||
echo
|
||||
|
||||
echo "8. Soft delete - single operation"
|
||||
curl -X PATCH "$BASE_URL/api/collections/shopping_items/items/test12345678901" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"op": "add", "path": "/deleted_at", "value": "2025-09-29T10:00:00Z"}'
|
||||
-d "{\"op\": \"add\", \"path\": \"/deleted_at\", \"value\": \"2025-09-29T10:00:00Z\"}"
|
||||
echo
|
||||
|
||||
echo "9. Final state"
|
||||
|
Reference in New Issue
Block a user