Skip to content

Commit adfcf61

Browse files
committed
update docs
1 parent 14d5865 commit adfcf61

File tree

3 files changed

+210
-259
lines changed

3 files changed

+210
-259
lines changed

docs/api/comments.md

Lines changed: 43 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,53 @@
1-
- # Comments API
2-
-
3-
- ## Overview
4-
-
5-
- The Comments API provides endpoints for managing video comments with real-time updates.
6-
-
7-
- ## REST Endpoints
8-
-
9-
- ### Create Comment
10-
-
11-
- ```http
1+
# Comments API
122

13-
```
14-
- POST /api/comments
15-
- Authorization: Bearer <token>
16-
- Content-Type: application/json
17-
-
18-
- {
19-
- "comment": {
20-
- "content": "Great video!",
21-
- "video_id": "video123"
22-
- }
23-
- }
24-
- ```
3+
## Overview
254

26-
```
27-
-
28-
- ### List Comments
29-
-
30-
- ```http
5+
The Comments API provides endpoints for managing video comments with real-time updates.
316

32-
```
33-
- GET /api/comments?video_id=video123&page=1&per_page=50
34-
- Authorization: Bearer <token>
35-
- ```
7+
## REST Endpoints
368

37-
```
38-
-
39-
- ### Delete Comment
40-
-
41-
- ```http
9+
### Create Comment
4210

43-
```
44-
- DELETE /api/comments/:id
45-
- Authorization: Bearer <token>
46-
- ```
11+
```http
12+
POST /api/comments
13+
Authorization: Bearer <token>
14+
Content-Type: application/json
15+
{
16+
"comment": {
17+
"content": "Great video!",
18+
"video_id": "video123"
19+
}
20+
}
21+
```
4722

48-
```
49-
-
50-
- ## WebSocket Events
51-
-
52-
- ### New Comment Event
53-
-
54-
- ```javascript
23+
### List Comments
5524

56-
```
57-
- channel.on("new_comment", payload => {
58-
- console.log("New comment:", payload);
59-
- });
60-
- ```
25+
```http
26+
GET /api/comments?video_id=video123&page=1&per_page=50
27+
Authorization: Bearer <token>
28+
```
6129

62-
```
63-
-
64-
- ### Comment Deleted Event
65-
-
66-
- ```javascript
30+
### Delete Comment
6731

68-
```
69-
- channel.on("comment_deleted", payload => {
70-
- console.log("Comment deleted:", payload);
71-
- });
72-
- ```
32+
```http
33+
DELETE /api/comments/:id
34+
Authorization: Bearer <token>
35+
```
7336

74-
```
37+
## WebSocket Events
38+
39+
### New Comment Event
40+
41+
```javascript
42+
channel.on("new_comment", (payload) => {
43+
console.log("New comment:", payload);
44+
});
45+
```
46+
47+
### Comment Deleted Event
48+
49+
```javascript
50+
channel.on("comment_deleted", (payload) => {
51+
console.log("Comment deleted:", payload);
52+
});
53+
```

docs/development.md

Lines changed: 117 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,121 @@
1-
- # Development Guide
2-
-
3-
- ## Code Organization
4-
-
5-
- ```
6-
7-
```
8-
- lib/
9-
- ├── realtime_server/ # Business logic
10-
- │ ├── accounts/ # User management
11-
- │ ├── comments/ # Comment context
12-
- │ ├── firebase/ # Firebase integration
13-
- │ ├── presence/ # Presence tracking
14-
- │ └── observability/ # Monitoring
15-
- ├── realtime_server_web/ # Web layer
16-
- │ ├── channels/ # WebSocket channels
17-
- │ ├── controllers/ # REST controllers
18-
- │ └── views/ # JSON views
19-
- └── mix.exs # Project configuration
20-
- ```
21-
22-
```
23-
-
24-
- ## Development Workflow
25-
-
26-
- ### 1. Setup Development Environment
27-
-
28-
- ```bash
29-
30-
```
31-
- # Clone repository
32-
- git clone https://github.com/your-org/realtime-server.git
33-
- cd realtime-server
34-
-
35-
- # Install dependencies
36-
- mix deps.get
37-
-
38-
- # Setup database
39-
- mix ecto.setup
40-
- ```
41-
42-
```
43-
-
44-
- ### 2. Running Tests
45-
-
46-
- ```bash
47-
48-
```
49-
- # Run all tests
50-
- mix test
51-
-
52-
- # Run with coverage
53-
- mix coveralls
54-
-
55-
- # Run specific test file
56-
- mix test test/realtime_server/comments_test.exs
57-
- ```
58-
59-
```
60-
-
61-
- ### 3. Code Quality
62-
-
63-
- ```bash
64-
65-
```
66-
- # Format code
67-
- mix format
68-
-
69-
- # Run linter
70-
- mix credo --strict
71-
-
72-
- # Run type checking
73-
- mix dialyzer
74-
- ```
75-
76-
```
77-
-
78-
- ## Testing Strategy
79-
-
80-
- ### Unit Tests
81-
- - Controllers
82-
- - Contexts
83-
- - Channels
84-
- - Views
85-
-
86-
- ### Integration Tests
87-
- - API endpoints
88-
- - WebSocket connections
89-
- - Database operations
90-
-
91-
- ### Performance Tests
92-
- - Load testing
93-
- - Stress testing
94-
- - Connection limits
95-
-
96-
- ## Git Workflow
97-
-
98-
- ### Branch Naming
99-
- - `feature/` - New features
100-
- - `fix/` - Bug fixes
101-
- - `docs/` - Documentation
102-
- - `refactor/` - Code refactoring
103-
-
104-
- ### Commit Messages
105-
- ```
106-
107-
```
1+
# Development Guide
2+
3+
## Code Organization
4+
5+
```
6+
lib/
7+
├── realtime_server/ # Business logic
8+
│ ├── accounts/ # User management
9+
│ ├── comments/ # Comment context
10+
│ ├── firebase/ # Firebase integration
11+
│ ├── presence/ # Presence tracking
12+
│ └── observability/ # Monitoring
13+
├── realtime_server_web/ # Web layer
14+
│ ├── channels/ # WebSocket channels
15+
│ ├── controllers/ # REST controllers
16+
│ └── views/ # JSON views
17+
└── mix.exs # Project configuration
18+
```
19+
20+
## Development Workflow
21+
22+
### 1. Setup Development Environment
23+
24+
```bash
25+
# Clone repository
26+
git clone https://github.com/your-org/realtime-server.git
27+
cd realtime-server
28+
29+
# Install dependencies
30+
mix deps.get
31+
32+
# Setup database
33+
mix ecto.setup
34+
```
35+
36+
### 2. Running Tests
37+
38+
```bash
39+
# Run all tests
40+
mix test
41+
42+
# Run with coverage
43+
mix coveralls
44+
45+
# Run specific test file
46+
mix test test/realtime_server/comments_test.exs
47+
```
48+
49+
### 3. Code Quality
50+
51+
```bash
52+
# Format code
53+
mix format
54+
55+
# Run linter
56+
mix credo --strict
57+
58+
# Run type checking
59+
mix dialyzer
60+
```
61+
62+
## Testing Strategy
63+
64+
### Unit Tests
65+
66+
- Controllers
67+
- Contexts
68+
- Channels
69+
- Views
70+
71+
### Integration Tests
72+
73+
- API endpoints
74+
- WebSocket connections
75+
- Database operations
76+
77+
### Performance Tests
78+
79+
- Load testing
80+
- Stress testing
81+
- Connection limits
82+
83+
## Git Workflow
84+
85+
### Branch Naming
86+
87+
- `feature/` - New features
88+
- `fix/` - Bug fixes
89+
- `docs/` - Documentation
90+
- `refactor/` - Code refactoring
91+
92+
### Commit Messages
93+
94+
```
10895
- feat: add user presence tracking
10996
- fix: handle disconnection edge case
11097
- docs: update API documentation
11198
- refactor: improve error handling
112-
- ```
113-
114-
```
115-
-
116-
- ## Debugging
117-
-
118-
- ### Logging
119-
- ```elixir
120-
121-
```
122-
- Logger.debug("Debug message", user_id: user.id)
123-
- Logger.info("Info message", %{event: "user_login"})
124-
- Logger.warning("Warning message", %{error: error})
125-
- ```
126-
127-
```
128-
-
129-
- ### IEx Session
130-
- ```bash
131-
132-
```
133-
- iex -S mix phx.server
134-
- ```
135-
136-
```
137-
-
138-
- ### Observer
139-
- ```bash
140-
141-
```
142-
- :observer.start()
143-
- ```
144-
145-
```
99+
```
100+
101+
## Debugging
102+
103+
### Logging
104+
105+
```elixir
106+
Logger.debug("Debug message", user_id: user.id)
107+
Logger.info("Info message", %{event: "user_login"})
108+
Logger.warning("Warning message", %{error: error})
109+
```
110+
111+
### IEx Session
112+
113+
```bash
114+
iex -S mix phx.server
115+
```
116+
117+
### Observer
118+
119+
```bash
120+
:observer.start()
121+
```

0 commit comments

Comments
 (0)