[ABANDONED] API server for Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

91 lines
2.3 KiB

import { JSONSchema } from 'fastify'
export const tokenResponseSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
access: { type: 'string' },
refresh: { type: 'string' },
expires: { type: 'number' },
},
}
export const postSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
userId: { type: 'string' },
text: { type: 'string' },
cover: { type: 'string' },
visible: { type: 'boolean' },
created: { type: 'number' },
},
}
export const userSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
name: { type: 'string' },
imageUrl: { type: 'string' },
coverImageUrl: { type: 'string' },
group: {
type: 'object',
properties: {
id: { type: 'string' },
name: { type: 'string' },
imageUrl: { type: 'string' },
coverImageUrl: { type: 'string' },
},
},
created: { type: 'number' },
subscription: { type: 'string' },
},
}
export const awardSchema: JSONSchema = {
type: 'object',
properties: {
userId: { type: 'string' },
imageUrl: { type: 'string' },
text: { type: 'string' },
userText: { type: 'string' },
created: { type: 'number' },
},
}
export const groupListingSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
name: { type: 'string' },
imageUrl: { type: 'string' },
coverImageUrl: { type: 'string' },
requiresApproval: { type: 'boolean' },
members: { type: 'number' },
posts: { type: 'number' },
awards: { type: 'number' },
points: { type: 'number' },
latestAwards: {
type: 'array',
items: awardSchema,
},
},
}
export const errorSchema: JSONSchema = {
type: 'object',
properties: {
message: { type: 'string' },
errors: {
type: 'array',
items: {
type: 'object',
properties: {
field: { type: 'string' },
message: { type: 'string' },
},
},
},
},
}