Skip to content

Commit 7bb728b

Browse files
authored
Update README.md
1 parent 0d9bd54 commit 7bb728b

File tree

1 file changed

+173
-0
lines changed

1 file changed

+173
-0
lines changed

README.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,183 @@ php artisan serve
5050

5151
The application will be accessible at `http://localhost:8000` by default. You can access the GraphQL playground at `http://localhost:8000/graphql-playground` to interact with the API.
5252

53+
## GraphQL
54+
55+
**Queries:**
56+
57+
- Get all blog posts: Retrieve a list of all blog posts with their titles and dates.
58+
- Get a single blog post: Retrieve detailed information about a specific blog post by its ID.
59+
- Search blog posts: Search for blog posts based on keywords and retrieve a list of matching posts.
60+
- Get all categories: Retrieve a list of all blog categories.
61+
- Get all tags: Retrieve a list of all blog tags.
62+
- Get recent posts: Retrieve a list of the most recent blog posts.
63+
- Get popular posts: Retrieve a list of the most popular blog posts based on views or comments.
64+
- Get comments for a post: Retrieve all comments associated with a specific blog post.
65+
- Get user profile: Retrieve information about the currently logged-in user.
66+
- Get user's own posts: Retrieve a list of blog posts created by the currently logged-in user.
67+
- Get user's favorite posts: Retrieve a list of blog posts marked as favorites by the currently logged-in user.
68+
- Get recommended posts: Retrieve a list of recommended blog posts based on user preferences or behavior.
69+
- Get posts by category: Retrieve all blog posts belonging to a specific category.
70+
- Get posts by tag: Retrieve all blog posts associated with a specific tag.
71+
- Get total number of posts: Retrieve the total number of blog posts in the system.Get posts by author: Retrieve all blog posts written by a specific author.
72+
- Get user by ID: Retrieve detailed information about a user by their ID.
73+
- Get trending tags: Retrieve a list of the most popular tags used in blog posts.
74+
- Get related posts: Retrieve a list of related blog posts based on the current post's tags or category.
75+
- Get post comments count: Retrieve the total number of comments for a specific blog post.
76+
- Get user activity: Retrieve a user's recent activity, including posts created, comments made, and liked posts.
77+
- Get most active users: Retrieve a list of the most active users based on the number of posts and comments they've made.
78+
- Get user notifications: Retrieve a list of notifications for the currently logged-in user.
79+
- Get posts by date range: Retrieve blog posts published within a specified date range.
80+
- Get posts by popularity: Retrieve blog posts sorted by popularity (e.g., based on likes, views, or comments).
81+
- Get posts by user's location: Retrieve blog posts based on the user's geolocation or specified location filter.
82+
- Get posts with specific metadata: Retrieve blog posts based on custom metadata or attributes associated with them.
83+
- Get user activity by date: Retrieve a user's activity within a specified date range, including posts and comments.
84+
- Get posts with attachments: Retrieve blog posts that have attachments such as images, videos, or files.
85+
- Get posts by popularity in a time range: Retrieve blog posts sorted by popularity within a specific time period (e.g., the last month).
86+
- Get posts by tag popularity: Retrieve tags ordered by their popularity based on the number of times they have been used.
87+
- Get posts with similar titles: Retrieve blog posts with titles similar to a given query.
88+
- Get posts based on language: Retrieve blog posts written in a specific language or language code.
89+
90+
**Mutations:**
91+
92+
- Create a new blog post: Create a new blog post with title, content, category, and tags.
93+
- Update a blog post: Update an existing blog post by its ID with new title, content, category, or tags.
94+
- Delete a blog post: Delete a specific blog post by its ID.
95+
- Create a new comment: Add a new comment to a blog post with the author's name and comment content.
96+
- Update a comment: Update an existing comment by its ID with new content.
97+
- Delete a comment: Delete a specific comment by its ID.
98+
- Like a post: Allow a user to like a blog post, incrementing its likes count.
99+
- Dislike a post: Allow a user to remove their like from a blog post, decrementing its likes count.
100+
- Add post to favorites: Allow a user to add a blog post to their list of favorite posts.
101+
- Remove post from favorites: Allow a user to remove a blog post from their list of favorite posts.
102+
- Register new user: Create a new user account with username, email, and password.
103+
- Login: Authenticate a user and issue an access token upon successful login.
104+
- Logout: Invalidate the user's access token upon logout.
105+
- Update user profile: Update the currently logged-in user's profile information.
106+
- Change password: Allow the user to change their account password.
107+
- Create a new category: Allow an admin user to create a new blog post category.
108+
- Update a category: Allow an admin user to update the name or description of a category.
109+
- Delete a category: Allow an admin user to delete a category, along with its associated blog posts.
110+
- Create a new tag: Allow an admin user to create a new blog post tag.
111+
- Update a tag: Allow an admin user to update the name or description of a tag.
112+
- Delete a tag: Allow an admin user to delete a tag, removing it from all associated blog posts.
113+
- Flag inappropriate content: Allow users to flag a blog post or comment as inappropriate for review by administrators.
114+
- Approve flagged content: Allow administrators to review flagged content and mark it as approved or disapproved.
115+
- Create a new user role: Allow an admin user to create a new role with specific permissions.
116+
- Update user role: Allow an admin user to update the permissions of an existing role.
117+
- Add post view: Increment the view count of a blog post when a user visits it.
118+
- Create a new user account with social login: Allow users to register using their social media accounts (e.g., Google or Facebook).
119+
- Reset user password: Allow users to request a password reset email if they forget their password.
120+
- Confirm email address: Enable users to confirm their email address after registration.
121+
- Delete user account: Allow users to delete their own accounts and associated data.
122+
- Share post: Allow users to share blog posts via email or social media.
123+
- Pin post: Allow an admin user to pin a blog post to the top of the homepage or a specific category.
124+
- Unpin post: Allow an admin user to remove a pinned status from a blog post.
125+
- Moderate comments: Allow moderators to review and approve or reject comments before they appear on the site.
126+
53127
## GraphQL Schema
54128

55129
The GraphQL schema defines the types, queries, mutations, and subscriptions available in the API. The schema can be found in the graphql directory.
56130

131+
```graphql
132+
type User {
133+
id: ID!
134+
username: String!
135+
email: String!
136+
posts: [Post!]!
137+
favoritePosts: [Post!]!
138+
createdAt: String!
139+
updatedAt: String!
140+
}
141+
142+
type Category {
143+
id: ID!
144+
name: String!
145+
description: String
146+
posts: [Post!]!
147+
}
148+
149+
type Tag {
150+
id: ID!
151+
name: String!
152+
description: String
153+
posts: [Post!]!
154+
}
155+
156+
type Comment {
157+
id: ID!
158+
content: String!
159+
author: User!
160+
post: Post!
161+
createdAt: String!
162+
updatedAt: String!
163+
}
164+
165+
type Post {
166+
id: ID!
167+
title: String!
168+
content: String!
169+
author: User!
170+
category: Category!
171+
tags: [Tag!]!
172+
comments: [Comment!]!
173+
likes: Int!
174+
views: Int!
175+
isPublished: Boolean!
176+
createdAt: String!
177+
updatedAt: String!
178+
}
179+
180+
type Notification {
181+
id: ID!
182+
message: String!
183+
user: User!
184+
createdAt: String!
185+
}
186+
187+
type AuthPayload {
188+
token: String!
189+
user: User!
190+
}
191+
192+
type Query {
193+
allPosts: [Post!]!
194+
post(id: ID!): Post
195+
searchPosts(query: String!): [Post!]!
196+
allCategories: [Category!]!
197+
allTags: [Tag!]!
198+
recentPosts(limit: Int!): [Post!]!
199+
popularPosts(limit: Int!): [Post!]!
200+
commentsByPost(postId: ID!): [Comment!]!
201+
user(id: ID!): User
202+
currentUser: User
203+
trendingTags(limit: Int!): [Tag!]!
204+
}
205+
206+
type Mutation {
207+
createPost(title: String!, content: String!, categoryId: ID!, tagIds: [ID!]!): Post!
208+
updatePost(id: ID!, title: String!, content: String!, categoryId: ID!, tagIds: [ID!]!): Post!
209+
deletePost(id: ID!): ID
210+
createComment(postId: ID!, content: String!): Comment!
211+
updateComment(id: ID!, content: String!): Comment!
212+
deleteComment(id: ID!): ID
213+
likePost(postId: ID!): Post!
214+
dislikePost(postId: ID!): Post!
215+
addToFavorites(postId: ID!): User!
216+
removeFromFavorites(postId: ID!): User!
217+
register(username: String!, email: String!, password: String!): AuthPayload!
218+
login(email: String!, password: String!): AuthPayload!
219+
logout: Boolean!
220+
updateProfile(username: String!, email: String!): User!
221+
changePassword(currentPassword: String!, newPassword: String!): Boolean!
222+
}
223+
224+
schema {
225+
query: Query
226+
mutation: Mutation
227+
}
228+
```
229+
57230
## Contributing
58231

59232
We welcome contributions from the community. If you want to contribute to the project, please fork the repository, make your changes, and submit a pull request.

0 commit comments

Comments
 (0)