chore: move update socials schema (#50506)

* chore: move update scoials schema

* fix: set maxLength value to satisfy tests
This commit is contained in:
Niraj Nandish
2023-05-24 22:57:19 +04:00
committed by GitHub
parent 2f77513a6a
commit a4ab0b4e18
2 changed files with 21 additions and 18 deletions

View File

@@ -80,24 +80,7 @@ export const settingRoutes: FastifyPluginCallbackTypebox = (
fastify.put(
'/update-my-socials',
{
schema: {
body: Type.Object({
website: Type.Optional(Type.String({ format: 'url' })),
twitter: Type.Optional(Type.String({ format: 'url' })),
githubProfile: Type.Optional(Type.String({ format: 'url' })),
linkedin: Type.Optional(Type.String({ format: 'url' }))
}),
response: {
200: Type.Object({
message: Type.Literal('flash.updated-socials'),
type: Type.Literal('success')
}),
500: Type.Object({
message: Type.Literal('flash.wrong-updating'),
type: Type.Literal('danger')
})
}
}
schema: schemas.updateMySocials
},
async (req, reply) => {
try {

View File

@@ -43,6 +43,26 @@ export const schemas = {
})
}
},
updateMySocials: {
body: Type.Object({
website: Type.Optional(Type.String({ format: 'url', maxLength: 1024 })),
twitter: Type.Optional(Type.String({ format: 'url', maxLength: 1024 })),
githubProfile: Type.Optional(
Type.String({ format: 'url', maxLength: 1024 })
),
linkedin: Type.Optional(Type.String({ format: 'url', maxLength: 1024 }))
}),
response: {
200: Type.Object({
message: Type.Literal('flash.updated-socials'),
type: Type.Literal('success')
}),
500: Type.Object({
message: Type.Literal('flash.wrong-updating'),
type: Type.Literal('danger')
})
}
},
updateMyKeyboardShortcuts: {
body: Type.Object({
keyboardShortcuts: Type.Boolean()