From 9554b5bc4276e526ff977a9b2e864199a3ce50d9 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Mon, 27 Jul 2026 16:31:39 +0530 Subject: [PATCH 1/2] chore(examples): ROSS-158: update todo example config to new schema format --- examples/todo/todo_config.json | 249 ++++++++++++++------------------- 1 file changed, 103 insertions(+), 146 deletions(-) diff --git a/examples/todo/todo_config.json b/examples/todo/todo_config.json index 14283f0..cbb19bc 100644 --- a/examples/todo/todo_config.json +++ b/examples/todo/todo_config.json @@ -1,150 +1,107 @@ { - "application": { - "logLevel": "debug", - "rateLimit": { - "enabled": true, - "max": 1000, - "timeWindow": "15m", - "useRedis": false - } - }, - "swagger": { - "enabled": true, - "basePath": "/api/docs", - "info": { - "title": "TODO app with authentication", - "description": "Example todo application with authentication using Rocket OSS", - "version": "v1.0.0", - "contact": { - "name": "Abhishek Chatterjee", - "url": "https://imdeepmind.com", - "email": "abhishek@imdeepmind.com" - }, - "license": { - "name": "MIT", - "url": "https://opensource.org/licenses/MIT" - } - } - }, + "application": { + "name": "Example TODO Application", + "logLevel": "debug", + "rateLimit": { + "enabled": true, + "max": 60, + "timeWindow": "1m" + } + }, + "docs": { + "openapi": { + "enabled": true, + "path": "/api/docs", + "info": { + "title": "Example TODO Application", + "description": "An example TODO application with authentication to show Rocket's capability", + "version": "v1.0.0" + } + } + }, + "infrastructure": { "database": { - "engine": "pg", - "connection": { - "urlOrPath": "env:DB" - }, - "dbTimeout": 10000 - }, - "models": [ - { - "name": "users", - "fields": [ - { - "name": "id", - "type": "integer", - "primaryKey": true, - "unique": true, - "nullable": false, - "supportedOperations": ["editable", "deletable", "greaterThanEqual"], - "supportedAggregation": ["count", "mean", "max", "min", "sum"] - }, - { - "name": "email", - "type": "string", - "unique": true, - "nullable": false, - "supportedOperations": ["searchable", "equal", "sortable", "indexable"], - "supportedAggregation": ["count"] - }, - { - "name": "password", - "type": "string", - "unique": false, - "nullable": false - }, - { - "name": "name", - "type": "string", - "nullable": true, - "supportedOperations": ["searchable", "sortable", "indexable"] - }, - { - "name": "is_active", - "type": "boolean", - "default": true, - "supportedOperations": ["equal"] - } - ], - "indexes": [ - { - "name": "users_email_idx", - "columns": ["email"], - "unique": true - }, - { - "name": "users_name_is_active_idx", - "columns": ["name", "is_active"], - "unique": false - } - ] + "engine": "sqlite", + "connection": { + "url": "./database.db" + }, + "timeout": 10000 + } + }, + "data": { + "models": { + "users": { + "timestamps": true, + "fields": { + "id": { + "type": "integer", + "primaryKey": true, + "autoIncrement": true, + "apis": ["edit", "delete", "index"] + }, + "name": { + "type": "string", + "nullable": false, + "apis": ["search"], + "query": ["sort"] + }, + "email": { + "type": "string", + "nullable": false, + "unique": true, + "apis": ["search"], + "query": ["sort"] + }, + "password": { + "type": "string", + "nullable": false + }, + "isVerified": { + "type": "boolean", + "default": true, + "query": ["eq"] + }, + "isActive": { + "type": "boolean", + "default": true, + "query": ["eq"] + } + } + }, + "todos": { + "timestamps": true, + "fields": { + "id": { + "type": "integer", + "primaryKey": true, + "autoIncrement": true, + "apis": ["edit", "delete", "index"] + }, + "title": { + "type": "string", + "nullable": false, + "apis": ["search"], + "query": ["sort"] + }, + "description": { + "type": "text" + }, + "authorId": { + "type": "integer", + "nullable": false + } }, - { - "name": "todos", - "fields": [ - { - "name": "id", - "type": "integer", - "primaryKey": true, - "unique": true, - "nullable": false, - "supportedOperations": ["editable", "deletable", "greaterThanEqual"], - "supportedAggregation": ["count", "mean", "max", "min", "sum"] - }, - { - "name": "title", - "type": "string", - "nullable": false, - "supportedOperations": ["searchable", "sortable"] - }, - { - "name": "body", - "type": "text", - "nullable": true - }, - { - "name": "user_id", - "type": "integer", - "nullable": false, - "supportedOperations": ["equal", "oneOf"], - "supportedAggregation": ["count"] - }, - { - "name": "status", - "type": "string", - "default": "pending", - "supportedOperations": ["equal", "oneOf"] - }, - { - "name": "created_at", - "type": "datetime", - "supportedOperations": ["lessThan", "greaterThan", "sortable"] - } - ], - "indexes": [ - { - "name": "todos_user_id_idx", - "columns": ["user_id"], - "unique": false - } - ], - "foreignKeys": [ - { - "name": "fk_todos_user_id", - "columns": ["user_id"], - "referenceTable": "users", - "referenceColumns": ["id"], - "onDelete": "CASCADE", - "onUpdate": "CASCADE" - } - ] + "relations": { + "todoAuthor": { + "type": "belongsTo", + "model": "users", + "localField": "authorId", + "foreignField": "id", + "onDelete": "cascade", + "onUpdate": "cascade" + } } - ] -} \ No newline at end of file + } + } + } +} From 5b325f78911e38b6bdb948ba5c9a7c4fc7d02412 Mon Sep 17 00:00:00 2001 From: Abhishek Chatterjee Date: Mon, 27 Jul 2026 17:56:08 +0530 Subject: [PATCH 2/2] chore(examples): ROSS-158: add auth, integrations, and apis sections to todo config --- examples/todo/todo_config.json | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/examples/todo/todo_config.json b/examples/todo/todo_config.json index cbb19bc..2c8ccae 100644 --- a/examples/todo/todo_config.json +++ b/examples/todo/todo_config.json @@ -23,11 +23,32 @@ "database": { "engine": "sqlite", "connection": { - "url": "./database.db" + "url": "/Users/imdeepmind/Desktop/WorkspaceV2/rocket/examples/todo/database.db" }, "timeout": 10000 } }, + "authentication": { + "enabled": true, + "provider": { + "type": "up-auth", + "config": { + "userModel": { + "model": "users", + "idField": "id", + "usernameField": "email", + "passwordField": "password", + "isVerifiedField": "isVerified" + }, + "jwtSecret": "your-super-secret-key-must-be-long-enough" + } + } + }, + "integrations": { + "email": { + "provider": "dummy" + } + }, "data": { "models": { "users": { @@ -103,5 +124,14 @@ } } } + }, + "apis": { + "model.todos.all.insert": { + "serverParams": [{ + "type": "body", + "name": "authorId", + "value": "[userId]" + }] + } } }