feat: APIのモデルを変更

This commit is contained in:
usbharu 2023-06-27 13:04:21 +09:00
parent 0dd7facbad
commit 7caae2cbaa
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
5 changed files with 8 additions and 34 deletions

View File

@ -303,22 +303,19 @@ components:
type: object
required:
- id
- userId
- user
- text
- createdAt
- visibility
- url
- sensitive
- apId
properties:
id:
type: integer
format: int64
readOnly: true
userId:
type: integer
format: int64
readOnly: true
user:
$ref: "#/components/schemas/UserResponse"
overview:
type: string
text:
@ -343,10 +340,6 @@ components:
readOnly: true
sensitive:
type: boolean
apId:
type: string
format: url
readOnly: true
PostRequest:
type: object

View File

@ -1,5 +0,0 @@
import {PostResponse, UserResponse} from "../generated";
export type PostDetails = PostResponse & {
user: UserResponse
}

View File

@ -2,10 +2,10 @@ import {Component, createSignal} from "solid-js";
import {Box, Card, CardActions, CardContent, CardHeader, IconButton, Menu, MenuItem, Typography} from "@suid/material";
import {Avatar} from "../atoms/Avatar";
import {Favorite, MoreVert, Reply, ScreenRotationAlt} from "@suid/icons-material";
import {PostDetails} from "../model/PostDetails";
import {ShareScopeIndicator} from "../molecules/ShareScopeIndicator";
import {PostResponse} from "../generated";
export const Post: Component<{ post: PostDetails }> = (props) => {
export const Post: Component<{ post: PostResponse }> = (props) => {
const [anchorEl, setAnchorEl] = createSignal<null | HTMLElement>(null)
const open = () => Boolean(anchorEl());
const handleClose = () => {

View File

@ -3,7 +3,6 @@ import {MainPage} from "../templates/MainPage";
import {PostForm} from "../organisms/PostForm";
import {Stack} from "@suid/material";
import {DefaultApi} from "../generated";
import {PostDetails} from "../model/PostDetails";
import {PostList} from "../templates/PostList";
import {ApiWrapper} from "../lib/ApiWrapper";
@ -16,20 +15,7 @@ export const TopPage: Component = () => {
<MainPage>
<Stack spacing={1} alignItems={"stretch"}>
<PostForm label={"投稿する"}/>
<PostList posts={posts()?.map(value => {
return {
...value,
user: {
id: 1234,
createdAt: Date.now(),
domain: "test-hideout.usbharu.dev",
name: "test",
url: "https://test-hideout.usbharu.dev",
screenName: "test",
description: ""
}
} as PostDetails
}) ?? []}/>
<PostList posts={posts() ?? []}/>
</Stack>
</MainPage>
)

View File

@ -1,9 +1,9 @@
import {Component, For} from "solid-js";
import {CircularProgress} from "@suid/material";
import {Post} from "../organisms/Post";
import {PostDetails} from "../model/PostDetails";
import {PostResponse} from "../generated";
export const PostList: Component<{ posts: PostDetails[] }> = (props) => {
export const PostList: Component<{ posts: PostResponse[] }> = (props) => {
return (
<For each={props.posts} fallback={<CircularProgress/>}>
{