Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
277 changes: 132 additions & 145 deletions examples/todo/todo_config.json
Original file line number Diff line number Diff line change
@@ -1,150 +1,137 @@
{
"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"
"engine": "sqlite",
"connection": {
"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"
},
"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
}
]
"jwtSecret": "your-super-secret-key-must-be-long-enough"
}
}
},
"integrations": {
"email": {
"provider": "dummy"
}
},
"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"
}
}
]
}
}
}
},
"apis": {
"model.todos.all.insert": {
"serverParams": [{
"type": "body",
"name": "authorId",
"value": "[userId]"
}]
}
}
}
Loading