feat: APIのモデルを変更

This commit is contained in:
usbharu 2023-06-27 13:04:21 +09:00
parent c48ae3b698
commit 24819e7224
5 changed files with 8 additions and 34 deletions

View File

@ -303,22 +303,19 @@ components:
type: object type: object
required: required:
- id - id
- userId - user
- text - text
- createdAt - createdAt
- visibility - visibility
- url - url
- sensitive - sensitive
- apId
properties: properties:
id: id:
type: integer type: integer
format: int64 format: int64
readOnly: true readOnly: true
userId: user:
type: integer $ref: "#/components/schemas/UserResponse"
format: int64
readOnly: true
overview: overview:
type: string type: string
text: text:
@ -343,10 +340,6 @@ components:
readOnly: true readOnly: true
sensitive: sensitive:
type: boolean type: boolean
apId:
type: string
format: url
readOnly: true
PostRequest: PostRequest:
type: object 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 {Box, Card, CardActions, CardContent, CardHeader, IconButton, Menu, MenuItem, Typography} from "@suid/material";
import {Avatar} from "../atoms/Avatar"; import {Avatar} from "../atoms/Avatar";
import {Favorite, MoreVert, Reply, ScreenRotationAlt} from "@suid/icons-material"; import {Favorite, MoreVert, Reply, ScreenRotationAlt} from "@suid/icons-material";
import {PostDetails} from "../model/PostDetails";
import {ShareScopeIndicator} from "../molecules/ShareScopeIndicator"; 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 [anchorEl, setAnchorEl] = createSignal<null | HTMLElement>(null)
const open = () => Boolean(anchorEl()); const open = () => Boolean(anchorEl());
const handleClose = () => { const handleClose = () => {

View File

@ -3,7 +3,6 @@ import {MainPage} from "../templates/MainPage";
import {PostForm} from "../organisms/PostForm"; import {PostForm} from "../organisms/PostForm";
import {Stack} from "@suid/material"; import {Stack} from "@suid/material";
import {DefaultApi} from "../generated"; import {DefaultApi} from "../generated";
import {PostDetails} from "../model/PostDetails";
import {PostList} from "../templates/PostList"; import {PostList} from "../templates/PostList";
import {ApiWrapper} from "../lib/ApiWrapper"; import {ApiWrapper} from "../lib/ApiWrapper";
@ -16,20 +15,7 @@ export const TopPage: Component = () => {
<MainPage> <MainPage>
<Stack spacing={1} alignItems={"stretch"}> <Stack spacing={1} alignItems={"stretch"}>
<PostForm label={"投稿する"}/> <PostForm label={"投稿する"}/>
<PostList posts={posts()?.map(value => { <PostList posts={posts() ?? []}/>
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
}) ?? []}/>
</Stack> </Stack>
</MainPage> </MainPage>
) )

View File

@ -1,9 +1,9 @@
import {Component, For} from "solid-js"; import {Component, For} from "solid-js";
import {CircularProgress} from "@suid/material"; import {CircularProgress} from "@suid/material";
import {Post} from "../organisms/Post"; 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 ( return (
<For each={props.posts} fallback={<CircularProgress/>}> <For each={props.posts} fallback={<CircularProgress/>}>
{ {