Skip to content

Commit ad82598

Browse files
committed
feat: init database
1 parent 2ffaa3c commit ad82598

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

docs/database.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
- Add block reason and notes
4545
- View block history
4646
- Unblock users manually
47-
4847
- **User Activity Monitoring**
4948
- View user activity logs
5049
- Track login attempts
@@ -60,7 +59,6 @@
6059
- Review reported posts
6160
- Pin/unpin important posts
6261
- Lock/unlock discussions
63-
6462
- **Comment Management**
6563
- Hide/show comments
6664
- Delete inappropriate comments
@@ -76,7 +74,6 @@
7674
- Manage category hierarchy
7775
- Set category permissions
7876
- Delete/merge categories
79-
8077
- **Category Settings**
8178
- Set posting guidelines
8279
- Configure auto-moderation
@@ -92,7 +89,6 @@
9289
- Set tag descriptions
9390
- Control tag usage
9491
- Merge similar tags
95-
9692
- **Tag Settings**
9793
- Set tag permissions
9894
- Configure tag suggestions
@@ -103,6 +99,7 @@
10399
### 5. Admin Tools
104100

105101
- **Dashboard**
102+
106103
- Activity overview
107104
- Moderation queue
108105
- Recent actions log
@@ -119,6 +116,7 @@
119116
### 6. Permission Management
120117

121118
- **Role-Based Access**
119+
122120
- Define admin roles
123121
- Set role permissions
124122
- Manage role assignments
@@ -140,14 +138,15 @@
140138
### 7. Reporting System
141139

142140
- **Content Reports**
141+
143142
- Review reported items
144143
- Track report status
145144
- Assign to moderators
146145
- Set resolution actions
147146
- Notify reporters
148147

149148
- **Report Categories**
150-
149+
151150
```typescript
152151
enum ReportReason {
153152
SPAM
@@ -162,6 +161,7 @@
162161
### 8. System Configuration
163162

164163
- **Site Settings**
164+
165165
- General configuration
166166
- Feature toggles
167167
- Theme management
@@ -178,6 +178,7 @@
178178
### 9. Analytics & Reporting
179179

180180
- **Usage Statistics**
181+
181182
- User engagement
182183
- Content metrics
183184
- Moderation actions
@@ -194,6 +195,7 @@
194195
### 10. Communication Tools
195196

196197
- **Announcements**
198+
197199
- Site-wide notices
198200
- Category announcements
199201
- User notifications
@@ -371,16 +373,16 @@ erDiagram
371373
User ||--o{ Notification : "receives"
372374
User ||--o{ Category : "creates"
373375
User ||--o{ Tag : "creates"
374-
376+
375377
Post ||--o{ Comment : "has"
376378
Post }|--|| Category : "belongs_to"
377379
Post ||--o{ PostHistory : "tracks"
378380
Post ||--o{ Flag : "receives"
379-
381+
380382
Category ||--o{ Category : "has_children"
381383
Tag ||--o{ Tag : "has_children"
382384
Comment ||--o{ Comment : "has_replies"
383-
385+
384386
Badge }o--o{ User : "awarded_to"
385387
Tag }o--o{ Post : "tagged_with"
386388
User }o--o{ User : "follows"
@@ -498,23 +500,27 @@ CREATE INDEX idx_media_mime ON "Media"(mime);
498500
## Key Features Implementation
499501

500502
1. **Full-Text Search**
503+
501504
- Uses PostgreSQL tsvector for efficient search
502505
- Indexes on post title and content
503506
- Indexes on comment content
504507
- Indexes on tag names
505508

506509
2. **Hierarchical Content**
510+
507511
- Categories with parent-child relationships
508512
- Tags with optional parent-child structure
509513
- Comments with nested replies
510514

511515
3. **Activity Tracking**
516+
512517
- Post view counts
513518
- Last activity timestamps
514519
- User engagement metrics
515520
- Content popularity tracking
516521

517522
4. **Moderation System**
523+
518524
- Flag queue for content moderation
519525
- User trust levels
520526
- Content status management

packages/database/src/posts/queries.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ export const getPosts = async (
6464
}
6565
}
6666

67-
export const createPost = async (data: Prisma.PostCreateInput): Promise<IActionReturn<TPostItem>> => {
67+
export const createPost = async (
68+
data: Prisma.PostCreateInput
69+
): Promise<IActionReturn<TPostItem>> => {
6870
let newPost: TPostItem
6971
try {
7072
newPost = await prisma.post.create({

packages/database/src/posts/selects.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ export const PostSelect = {
3939
export type TPostItem = Prisma.PostGetPayload<{
4040
select: typeof PostSelect
4141
}>
42-

0 commit comments

Comments
 (0)