Skip to content

Commit

Permalink
いらないデータを送らないように
Browse files Browse the repository at this point in the history
  • Loading branch information
mehm8128 committed Mar 24, 2024
1 parent 27fd008 commit 706aaf8
Show file tree
Hide file tree
Showing 21 changed files with 16 additions and 395 deletions.
29 changes: 1 addition & 28 deletions workspaces/schema/src/api/authors/GetAuthorListResponse.ts
@@ -1,41 +1,14 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author } from '../../models';

export const GetAuthorListResponseSchema = createSelectSchema(author)
.pick({
description: true,
id: true,
name: true,
})
.extend({
books: createSelectSchema(book)
.pick({
description: true,
id: true,
name: true,
})
.extend({
episodes: createSelectSchema(episode)
.pick({
chapter: true,
description: true,
id: true,
name: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
})
.array();

export type GetAuthorListResponse = z.infer<typeof GetAuthorListResponseSchema>;
10 changes: 1 addition & 9 deletions workspaces/schema/src/api/authors/GetAuthorResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author, book, image } from '../../models';

export const GetAuthorResponseSchema = createSelectSchema(author)
.pick({
Expand All @@ -17,14 +17,6 @@ export const GetAuthorResponseSchema = createSelectSchema(author)
name: true,
})
.extend({
episodes: createSelectSchema(episode)
.pick({
chapter: true,
description: true,
id: true,
name: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
10 changes: 1 addition & 9 deletions workspaces/schema/src/api/authors/PatchAuthorResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author, book, image } from '../../models';

export const PatchAuthorResponseSchema = createSelectSchema(author)
.pick({
Expand All @@ -17,14 +17,6 @@ export const PatchAuthorResponseSchema = createSelectSchema(author)
name: true,
})
.extend({
episodes: createSelectSchema(episode)
.pick({
chapter: true,
description: true,
id: true,
name: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
10 changes: 1 addition & 9 deletions workspaces/schema/src/api/authors/PostAuthorResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author, book, image } from '../../models';

export const PostAuthorResponseSchema = createSelectSchema(author)
.pick({
Expand All @@ -17,14 +17,6 @@ export const PostAuthorResponseSchema = createSelectSchema(author)
name: true,
})
.extend({
episodes: createSelectSchema(episode)
.pick({
chapter: true,
description: true,
id: true,
name: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
7 changes: 1 addition & 6 deletions workspaces/schema/src/api/books/GetBookListResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author, book, image } from '../../models';

export const GetBookListResponseSchema = createSelectSchema(book)
.pick({
Expand All @@ -23,11 +23,6 @@ export const GetBookListResponseSchema = createSelectSchema(book)
id: true,
}),
}),
episodes: createSelectSchema(episode)
.pick({
id: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
7 changes: 1 addition & 6 deletions workspaces/schema/src/api/books/GetBookResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author, book, image } from '../../models';

export const GetBookResponseSchema = createSelectSchema(book)
.pick({
Expand All @@ -23,11 +23,6 @@ export const GetBookResponseSchema = createSelectSchema(book)
id: true,
}),
}),
episodes: createSelectSchema(episode)
.pick({
id: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
7 changes: 1 addition & 6 deletions workspaces/schema/src/api/books/PatchBookResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author, book, image } from '../../models';

export const PatchBookResponseSchema = createSelectSchema(book)
.pick({
Expand All @@ -23,11 +23,6 @@ export const PatchBookResponseSchema = createSelectSchema(book)
id: true,
}),
}),
episodes: createSelectSchema(episode)
.pick({
id: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
7 changes: 1 addition & 6 deletions workspaces/schema/src/api/books/PostBookResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, image } from '../../models';
import { author, book, image } from '../../models';

export const PostBookResponseSchema = createSelectSchema(book)
.pick({
Expand All @@ -23,11 +23,6 @@ export const PostBookResponseSchema = createSelectSchema(book)
id: true,
}),
}),
episodes: createSelectSchema(episode)
.pick({
id: true,
})
.array(),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
39 changes: 1 addition & 38 deletions workspaces/schema/src/api/episodes/GetEpisodeListResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, episodePage, image } from '../../models';
import { episode, image } from '../../models';

export const GetEpisodeListResponseSchema = createSelectSchema(episode)
.pick({
Expand All @@ -12,47 +12,10 @@ export const GetEpisodeListResponseSchema = createSelectSchema(episode)
nameRuby: true,
})
.extend({
book: createSelectSchema(book)
.pick({
description: true,
id: true,
name: true,
nameRuby: true,
})
.extend({
author: createSelectSchema(author)
.pick({
description: true,
id: true,
name: true,
})
.extend({
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
}),
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
}),
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
pages: createSelectSchema(episodePage)
.pick({
id: true,
page: true,
})
.extend({
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
})
.array(),
})
.array();

Expand Down
27 changes: 1 addition & 26 deletions workspaces/schema/src/api/episodes/GetEpisodeResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, episodePage, image } from '../../models';
import { episode, episodePage, image } from '../../models';

export const GetEpisodeResponseSchema = createSelectSchema(episode)
.pick({
Expand All @@ -12,31 +12,6 @@ export const GetEpisodeResponseSchema = createSelectSchema(episode)
nameRuby: true,
})
.extend({
book: createSelectSchema(book)
.pick({
description: true,
id: true,
name: true,
nameRuby: true,
})
.extend({
author: createSelectSchema(author)
.pick({
description: true,
id: true,
name: true,
})
.extend({
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
}),
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
}),
image: createSelectSchema(image).pick({
alt: true,
id: true,
Expand Down
39 changes: 1 addition & 38 deletions workspaces/schema/src/api/episodes/PatchEpisodeResponse.ts
@@ -1,7 +1,7 @@
import { createSelectSchema } from 'drizzle-zod';
import type { z } from 'zod';

import { author, book, episode, episodePage, image } from '../../models';
import { episode, image } from '../../models';

export const PatchEpisodeResponseSchema = createSelectSchema(episode)
.pick({
Expand All @@ -12,47 +12,10 @@ export const PatchEpisodeResponseSchema = createSelectSchema(episode)
nameRuby: true,
})
.extend({
book: createSelectSchema(book)
.pick({
description: true,
id: true,
name: true,
nameRuby: true,
})
.extend({
author: createSelectSchema(author)
.pick({
description: true,
id: true,
name: true,
})
.extend({
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
}),
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
}),
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
pages: createSelectSchema(episodePage)
.pick({
id: true,
page: true,
})
.extend({
image: createSelectSchema(image).pick({
alt: true,
id: true,
}),
})
.array(),
});

export type PatchEpisodeResponse = z.infer<typeof PatchEpisodeResponseSchema>;

0 comments on commit 706aaf8

Please sign in to comment.