From 9e8982de47ab9dd98b1f9793ecd0960b791328c4 Mon Sep 17 00:00:00 2001 From: Katsukiniwa Date: Thu, 29 Feb 2024 22:18:10 +0900 Subject: [PATCH] chore: update --- .../app/dashboard/@questions/[id]/page.tsx | 33 +++++++++++++++++++ .../app/dashboard/@questions/draft/page.tsx | 33 +++++++++++++++++++ admin/src/app/dashboard/@questions/page.tsx | 8 ++++- backend/app/controllers/users_controller.rb | 1 + backend/app/serializers/user_serializer.rb | 2 +- 5 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 admin/src/app/dashboard/@questions/[id]/page.tsx create mode 100644 admin/src/app/dashboard/@questions/draft/page.tsx diff --git a/admin/src/app/dashboard/@questions/[id]/page.tsx b/admin/src/app/dashboard/@questions/[id]/page.tsx new file mode 100644 index 0000000..ece9e16 --- /dev/null +++ b/admin/src/app/dashboard/@questions/[id]/page.tsx @@ -0,0 +1,33 @@ +import { getQuestionsByCategoryId } from "@/lib/data"; +import { Table, Heading } from "@radix-ui/themes"; +import Link from "next/link"; + +export default async function Page({ params }: { params: { id: string } }) { + const questions = await getQuestionsByCategoryId(Number(params.id)); + + return ( +
+ Questions + back + + + + id + title + content + + + + + {questions.map((question) => ( + + {question.id} + {question.title} + {question.content} + + ))} + + +
+ ); +} diff --git a/admin/src/app/dashboard/@questions/draft/page.tsx b/admin/src/app/dashboard/@questions/draft/page.tsx new file mode 100644 index 0000000..dd8fed6 --- /dev/null +++ b/admin/src/app/dashboard/@questions/draft/page.tsx @@ -0,0 +1,33 @@ +import { getQuestionsByCategoryId } from "@/lib/data"; +import { Table, Heading } from "@radix-ui/themes"; +import Link from "next/link"; + +export default async function Page() { + const questions = await getQuestionsByCategoryId(1); + + return ( +
+ Questions + back + + + + id + title + content + + + + + {questions.map((question) => ( + + {question.id} + {question.title} + {question.content} + + ))} + + +
+ ); +} diff --git a/admin/src/app/dashboard/@questions/page.tsx b/admin/src/app/dashboard/@questions/page.tsx index 12343cd..c6d1632 100644 --- a/admin/src/app/dashboard/@questions/page.tsx +++ b/admin/src/app/dashboard/@questions/page.tsx @@ -1,5 +1,6 @@ import { getQuestions } from "@/lib/data"; import { Table, Heading } from "@radix-ui/themes"; +import Link from "next/link"; export default async function Page() { const questions = await getQuestions(); @@ -7,6 +8,9 @@ export default async function Page() { return (
Questions + + Draft + @@ -19,7 +23,9 @@ export default async function Page() { {questions.map((question) => ( - {question.id} + + {question.id} + {question.title} {question.content} diff --git a/backend/app/controllers/users_controller.rb b/backend/app/controllers/users_controller.rb index 7175e70..da32547 100644 --- a/backend/app/controllers/users_controller.rb +++ b/backend/app/controllers/users_controller.rb @@ -4,6 +4,7 @@ class UsersController < ApplicationController # GET /users def index @users = User.all + pp @users.count render json: @users end diff --git a/backend/app/serializers/user_serializer.rb b/backend/app/serializers/user_serializer.rb index e99eccd..bcd5133 100644 --- a/backend/app/serializers/user_serializer.rb +++ b/backend/app/serializers/user_serializer.rb @@ -16,5 +16,5 @@ # index_users_on_email (email) UNIQUE # class UserSerializer < ActiveModel::Serializer - attributes :id, :name, :icon, :email + attributes :id, :name, :email end