Skip to content

Commit ae6e6af

Browse files
committed
fix(api): Post id and body aren't actually required at input
1 parent 3cba1e5 commit ae6e6af

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

apps/miiverse-api/src/models/post.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import type { PostData, PostPainting, PostScreenshot, PostTopicTag } from '@/typ
1212
* If you add default: or required:, please also update IPost and IPostInput!
1313
*/
1414
const PostSchema = new Schema<IPost, PostModel, IPostMethods>({
15-
id: { type: String, required: true },
15+
id: { type: String }, // generated in save hook
1616
title_id: { type: String },
1717
screen_name: { type: String, required: true },
18-
body: { type: String, required: true },
18+
body: {
19+
type: String,
20+
default: ''
21+
},
1922
app_data: { type: String },
2023

2124
painting: { type: String },

apps/miiverse-api/src/types/mongoose/post.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export interface IPost {
5757
// on input but not output
5858
// We really need an ORM
5959
type PostDefaultedFields =
60+
'id' | // generated in save hook
61+
'body' |
6062
'is_autopost' |
6163
'is_community_private_autopost' |
6264
'is_spoiler' |

0 commit comments

Comments
 (0)