Skip to content

Commit ecb5081

Browse files
committed
backup
1 parent 8a1b3b5 commit ecb5081

File tree

15 files changed

+369
-51
lines changed

15 files changed

+369
-51
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install -r requirements.txt
32-
3328
- name: Run Tox
3429
run: |
35-
pip install tox==4.16.0
30+
python -m pip install --upgrade pip
31+
pip install tox==4.17.0
3632
tox -e py

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ repos:
1919
rev: v0.5.4
2020
hooks:
2121
- id: ruff
22-
args: [--fix, --exclude, alembic/]
22+
args: [--fix]
2323
- id: ruff-format

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ migrate: ## Apply the database migration
4646
$(ALEMBIC) upgrade head
4747

4848
check: ## Run all checks using tox and pre-commit
49-
$(PIP) install tox==4.16.0 pre-commit==3.8.0
49+
$(PIP) install tox==4.17.0 pre-commit==3.8.0
5050
$(TOX)
5151
$(PRE_COMMIT) install
5252
$(PRE_COMMIT) run --all-files

TODO.md

Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
# TODO
2+
3+
- [] Contributing.md
4+
- [] Remove ruff from pre-commit and replace with tox
5+
- [] Add CI workflows for dev, staging and prod branches
6+
- [] Feat: Blog category, Blog Comment, Blog Status, Search and Filter, Add more fields to Blog model
7+
- Change id to uuid
8+
9+
# Project Setup
10+
11+
## Prerequisites
12+
13+
Before you begin, ensure you have the following:
14+
15+
- A Linux environment, or WSL (if using Windows)
16+
- Python 3.10 or later installed
17+
18+
## Step-by-Step Instructions
19+
20+
### 1. Clone the Repository
21+
22+
```bash
23+
git clone https://github.com/Pythonian/fastapi_web.git
24+
cd fastapi_web
25+
```
26+
27+
### 2. Create a Virtual Environment
28+
29+
```bash
30+
make venv
31+
source .venv/bin/activate
32+
```
33+
34+
### 3. Install Dependencies
35+
36+
```bash
37+
make install
38+
```
39+
40+
### 4. Configure Environment
41+
42+
Update the `.env` file with your specific configuration values.
43+
44+
### 5. Database Migrations
45+
46+
Run the migrations to set up your database tables:
47+
48+
```bash
49+
make migrate
50+
```
51+
52+
### 6. Running Checks
53+
54+
Ensure everything is set up correctly:
55+
56+
```bash
57+
make check
58+
```
59+
60+
### 7. Start the Development Server
61+
62+
```bash
63+
make run
64+
```
65+
66+
### 8. Cleaning Up
67+
68+
To clean up the project directory:
69+
70+
```bash
71+
make clean
72+
```
73+
74+
You can run `make` to see all available commands.
75+
76+
### 4. API Endpoints
77+
78+
---
79+
80+
# API Endpoints
81+
82+
Detailed documentation of available API endpoints.
83+
84+
## Blog Endpoints
85+
86+
### Create a Blog Post
87+
88+
- **URL**: `/v1/blog/`
89+
- **Method**: `POST`
90+
- **Request Body**:
91+
92+
```json
93+
{
94+
"title": "string",
95+
"content": "string",
96+
"author": "string"
97+
}
98+
```
99+
100+
- **Response**:
101+
102+
```json
103+
{
104+
"id": "integer",
105+
"title": "string",
106+
"content": "string",
107+
"author": "string",
108+
"created_at": "datetime"
109+
}
110+
```
111+
112+
### Get Blog Posts
113+
114+
- **URL**: `/v1/blog/`
115+
- **Method**: `GET`
116+
- **Response**:
117+
118+
```json
119+
[
120+
{
121+
"id": "integer",
122+
"title": "string",
123+
"content": "string",
124+
"author": "string",
125+
"created_at": "datetime"
126+
}
127+
]
128+
```
129+
130+
### Get a Single Blog Post
131+
132+
- **URL**: `/v1/blog/{id}`
133+
- **Method**: `GET`
134+
- **Response**:
135+
136+
```json
137+
{
138+
"id": "integer",
139+
"title": "string",
140+
"content": "string",
141+
"author": "string",
142+
"created_at": "datetime"
143+
}
144+
```
145+
146+
### Update a Blog Post
147+
148+
- **URL**: `/v1/blog/{id}`
149+
- **Method**: `PUT`
150+
- **Request Body**:
151+
152+
```json
153+
{
154+
"title": "string",
155+
"content": "string",
156+
"author": "string"
157+
}
158+
```
159+
160+
- **Response**:
161+
162+
```json
163+
{
164+
"id": "integer",
165+
"title": "string",
166+
"content": "string",
167+
"author": "string",
168+
"created_at": "datetime"
169+
}
170+
```
171+
172+
### Delete a Blog Post
173+
174+
- **URL**: `/v1/blog/{id}`
175+
- **Method**: `DELETE`
176+
- **Response**:
177+
178+
```json
179+
{
180+
"message": "Blog post deleted successfully"
181+
}
182+
```
183+
184+
### 3. API Endpoints
185+
186+
The "API Endpoints" page should document the available API endpoints, their purposes, and how to use them. Here's an example:
187+
188+
This page provides detailed documentation of the available API endpoints in the project.
189+
190+
## Blog Endpoints
191+
192+
### Create a Blog Post
193+
194+
- **URL**: `/v1/blog/`
195+
- **Method**: `POST`
196+
- **Description**: Create a new blog post.
197+
- **Request Body**:
198+
199+
```json
200+
{
201+
"title": "string",
202+
"content": "string",
203+
"author": "string"
204+
}
205+
```
206+
207+
- **Response**:
208+
209+
```json
210+
{
211+
"id": "integer",
212+
"title": "string",
213+
"content": "string",
214+
"author": "string",
215+
"created_at": "datetime"
216+
}
217+
```
218+
219+
### Get Blog Posts
220+
221+
- **URL**: `/v1/blog/`
222+
- **Method**: `GET`
223+
- **Description**: Retrieve a list of blog posts.
224+
- **Response**:
225+
226+
```json
227+
[
228+
{
229+
"id": "integer",
230+
"title": "string",
231+
"content": "string",
232+
"author": "string",
233+
"created_at": "datetime"
234+
}
235+
]
236+
```
237+
238+
### Get a Single Blog Post
239+
240+
- **URL**: `/v1/blog/{id}`
241+
- **Method**: `GET`
242+
- **Description**: Retrieve a single blog post by its ID.
243+
- **Response**:
244+
245+
```json
246+
{
247+
"id": "integer",
248+
"title": "string",
249+
"content": "string",
250+
"author": "string",
251+
"created_at": "datetime"
252+
}
253+
```
254+
255+
### Update a Blog Post
256+
257+
- **URL**: `/v1/blog/{id}`
258+
- **Method**: `PUT`
259+
- **Description**: Update an existing blog post.
260+
- **Request Body**:
261+
262+
```json
263+
{
264+
"title": "string",
265+
"content": "string",
266+
"author": "string"
267+
}
268+
```
269+
270+
- **Response**:
271+
272+
```json
273+
{
274+
"id": "integer",
275+
"title": "string",
276+
"content": "string",
277+
"author": "string",
278+
"created_at": "datetime"
279+
}
280+
```
281+
282+
### Delete a Blog Post
283+
284+
- **URL**: `/v1/blog/{id}`
285+
- **Method**: `DELETE`
286+
- **Description**: Delete a blog post by its ID.
287+
- **Response**:
288+
289+
```json
290+
{
291+
"message": "Blog post deleted successfully"
292+
}
293+
```
294+
295+
Rate limiting
296+
Caching
297+
PATCH to PUT?
298+
read_blog - 400 bad request?

api/v1/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from api.v1.models.user import User
55
"""
66

7-
from api.v1.models.blog import Blog # noqa: F401
7+
from api.v1.models.blog import Blog

0 commit comments

Comments
 (0)