Pipelinen parannuksia building blockeilla
This commit is contained in:
112
zipit/rest_api_check/prompts/1_manager_json-speksi.md
Normal file
112
zipit/rest_api_check/prompts/1_manager_json-speksi.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# 1 — Manager (manager) — JSON-speksi
|
||||
|
||||
**Malli:** `qwen-coder`
|
||||
|
||||
## System Prompt
|
||||
|
||||
```
|
||||
You are a software architect. Given a project description, output a JSON specification.
|
||||
Output ONLY valid JSON, no explanations. Follow this exact schema:
|
||||
{
|
||||
"project_name": "short-name",
|
||||
"description": "One sentence",
|
||||
"entities": [
|
||||
{
|
||||
"name": "Todo",
|
||||
"table_name": "todos",
|
||||
"fields": [
|
||||
{"name": "title", "sa_type": "String(255)", "py_type": "str", "nullable": false, "default": null},
|
||||
{"name": "description", "sa_type": "Text", "py_type": "str | None", "nullable": true, "default": null},
|
||||
{"name": "status", "sa_type": "String(20)", "py_type": "str", "nullable": false, "default": "pending"}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extra_imports": ["from datetime import date"]
|
||||
}
|
||||
RULES:
|
||||
- sa_type: SQLAlchemy column type (String(N), Text, Integer, Date, DateTime, Boolean, Float)
|
||||
- py_type: Python type hint (str, int, float, bool, date, datetime, str | None, etc.)
|
||||
- Do NOT use Enum — use String(20) with a default value for status fields
|
||||
- nullable: true = optional field
|
||||
- default: null = no default, otherwise a string/number value
|
||||
- extra_imports: stdlib imports needed in schemas.py (e.g. "from datetime import date")
|
||||
- entity name: PascalCase singular, table_name: snake_case plural
|
||||
- Keep it simple: 1-3 entities, 3-7 fields each
|
||||
```
|
||||
|
||||
## Syöte
|
||||
|
||||
```
|
||||
**PROJECT NAME:** User Management REST API
|
||||
|
||||
**GOAL:** To develop a RESTful API for managing users using an SQLite database.
|
||||
|
||||
**CORE FEATURES:**
|
||||
1. Register new users with username, email, and password.
|
||||
2. Authenticate users to gain access to the system.
|
||||
3. Update user profile information (email, password).
|
||||
4. Delete existing users.
|
||||
5. Retrieve all registered users.
|
||||
6. Retrieve a specific user by ID.
|
||||
7. Search for users based on partial usernames or emails.
|
||||
|
||||
**DATA MODEL:**
|
||||
- **User:**
|
||||
- UserID (Integer, Primary Key)
|
||||
- Username (String, Unique)
|
||||
- Email (String, Unique)
|
||||
- PasswordHash (String)
|
||||
|
||||
**API ENDPOINTS:**
|
||||
1. **POST /users/register**: Register a new user.
|
||||
- Request Body:
|
||||
{
|
||||
"username": "johndoe",
|
||||
"email": "john@example.com",
|
||||
"password": "securepassword"
|
||||
}
|
||||
2. **POST /auth/login**: Authenticate a user and return a token.
|
||||
- Request Body:
|
||||
{
|
||||
"username": "johndoe",
|
||||
"password": "securepassword"
|
||||
}
|
||||
3. **PUT /users/{UserID}**: Update a specific user's profile.
|
||||
- Path Parameter: UserID (Integer)
|
||||
- Request Body:
|
||||
{
|
||||
"email": "newjohn@example.com",
|
||||
"password": "newsecurepassword"
|
||||
}
|
||||
4. **DELETE /users/{UserID}**: Delete a specific user.
|
||||
- Path Parameter: UserID (Integer)
|
||||
5. **GET /users**: Retrieve all registered users.
|
||||
6. **GET /users/{UserID}**: Retrieve a specific user by ID.
|
||||
7. **GET /users/search?query={searchTerm}**: Search for users based on partial usernames or emails.
|
||||
|
||||
**CONSTRAINTS:**
|
||||
- Must use SQLite as the database.
|
||||
- No authentication is needed to view all users, but authentication is required to update or delete any user.
|
||||
```
|
||||
|
||||
## Tulos
|
||||
|
||||
```
|
||||
{
|
||||
"project_name": "UserManagementAPI",
|
||||
"description": "RESTful API for managing users using an SQLite database.",
|
||||
"entities": [
|
||||
{
|
||||
"name": "User",
|
||||
"table_name": "users",
|
||||
"fields": [
|
||||
{"name": "UserID", "sa_type": "Integer", "py_type": "int", "nullable": false, "default": null},
|
||||
{"name": "Username", "sa_type": "String(255)", "py_type": "str", "nullable": false, "unique": true},
|
||||
{"name": "Email", "sa_type": "String(255)", "py_type": "str", "nullable": false, "unique": true},
|
||||
{"name": "PasswordHash", "sa_type": "String(255)", "py_type": "str", "nullable": false}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extra_imports": []
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user