diff --git a/client/GraphQLQueries.md b/client/GraphQLQueries.md new file mode 100644 index 0000000..b9bc069 --- /dev/null +++ b/client/GraphQLQueries.md @@ -0,0 +1,84 @@ +### Queries + + - Get Article By Slug + ``` + query GetPostBySlug($slug: String){ + articleByLink(link: $slug){ + id + title + thumbnail + } + } + ``` + + - Get all articles + ``` + query GetAllArticle{ + allArticles{ + id + title + content + thumbnail + link + createdAt + author{ + id + name + } + category{ + id + } + } + } + ``` + +### Mutations + - Create category + ``` + mutation CreateCategory{ + createOrUpdateCategory(name: "Category - 10" ){ + category{ + id + name + } + } + } + ``` + + - Create an article with curl + ``` + curl --location 'http://localhost:8000/graphql/' \ + --form 'operations="{ + \"query\": \"mutation ($title: String!, $content: String!, $thumbnail: Upload!, $authorId: ID!, $categoryId: ID!, $id: ID) { createOrUpdateArticle(title: $title, content: $content, thumbnail: $thumbnail, authorId: $authorId, categoryId: $categoryId, id: $id) { article { id title content thumbnail author { id name } category { id name } } } }\", + \"variables\": { + \"title\": \"Test Article - 10\", + \"content\": \"This is a test article\", + \"thumbnail\": null, + \"authorId\": \"1\", + \"categoryId\": \"1\" + } + }"' \ + --form 'map="{ + \"0\": [\"variables.thumbnail\"] + }"' \ + --form '0=@"/home/shayon/Pictures/pexels-daniel-reis-19575513.jpg"' + ``` + + - Create a comment + ``` + mutation CreateComment{ + createOrUpdateComment(author: "Md SHayon", email:"eg1@e.com", text: "This is comment 1", articleId: 8){ + comment{ + id + article{ + id + title + link + } + author + email + text + } + } + } + ``` \ No newline at end of file diff --git a/client/README.md b/client/README.md index f5db2a2..48e46c1 100644 --- a/client/README.md +++ b/client/README.md @@ -1,75 +1,4 @@ -# Nuxt 3 Minimal Starter +# Nuxt js blog -Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more. - -## Setup - -Make sure to install the dependencies: - -```bash -# npm -npm install - -# pnpm -pnpm install - -# yarn -yarn install - -# bun -bun install -``` - -## Development Server - -Start the development server on `http://localhost:3000`: - -```bash -# npm -npm run dev - -# pnpm -pnpm run dev - -# yarn -yarn dev - -# bun -bun run dev -``` - -## Production - -Build the application for production: - -```bash -# npm -npm run build - -# pnpm -pnpm run build - -# yarn -yarn build - -# bun -bun run build -``` - -Locally preview production build: - -```bash -# npm -npm run preview - -# pnpm -pnpm run preview - -# yarn -yarn preview - -# bun -bun run preview -``` - -Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. + - Add article with thumbnail image + - Display article content properly according to quill editor \ No newline at end of file diff --git a/client/components/article/Article.vue b/client/components/article/Article.vue index a241864..102ee25 100644 --- a/client/components/article/Article.vue +++ b/client/components/article/Article.vue @@ -18,13 +18,13 @@ --> -

{{ article.title }}

- + {{ article.createdAt }}

{{ article.content }}

diff --git a/client/components/article/ArticleAdd.vue b/client/components/article/ArticleAdd.vue index 7a66b0e..b462f74 100644 --- a/client/components/article/ArticleAdd.vue +++ b/client/components/article/ArticleAdd.vue @@ -4,11 +4,18 @@
- + +
+
+ + +
- + -

{{ data.articleByLink.content }}

diff --git a/client/components/home/Home.vue b/client/components/home/Home.vue index 5e29df9..95550b6 100644 --- a/client/components/home/Home.vue +++ b/client/components/home/Home.vue @@ -23,6 +23,7 @@ content thumbnail link + createdAt author { id name diff --git a/client/components/home/Posts.vue b/client/components/home/Posts.vue index ce630a8..e615d56 100644 --- a/client/components/home/Posts.vue +++ b/client/components/home/Posts.vue @@ -1,13 +1,15 @@