Fix some bullshit

This commit is contained in:
2025-09-29 12:22:01 +02:00
parent 6b7a519be9
commit ff0d0b3bd3
2 changed files with 15 additions and 11 deletions

View File

@@ -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,

View File

@@ -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"