[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.
 

144 lines
3.9 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 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' },
about: { type: 'string' },
imageUrl: { type: 'string' },
coverImageUrl: { type: 'string' },
iconImageUrl: { type: 'string' },
requiresApproval: { type: 'boolean' },
members: { type: 'number' },
posts: { type: 'number' },
awards: { type: 'number' },
points: { type: 'number' },
created: { type: 'number' },
membership: { type: 'string' },
latestAwards: {
type: 'array',
items: awardSchema,
},
},
}
export const userSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
name: { type: 'string' },
about: { type: 'string' },
imageUrl: { type: 'string' },
coverImageUrl: { type: 'string' },
group: groupListingSchema,
subscription: { type: 'string' },
membership: { type: 'string' },
posts: { type: 'number' },
awards: { type: 'number' },
points: { type: 'number' },
created: { type: 'number' },
},
}
export const postSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
user: userSchema,
text: { type: 'string' },
cover: { type: 'string' },
visible: { type: 'boolean' },
created: { type: 'number' },
},
}
export const appSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
user: userSchema,
name: { type: 'string' },
displayName: { type: 'string' },
imageUrl: { type: 'string' },
coverImageUrl: { type: 'string' },
iconImageUrl: { type: 'string' },
about: { type: 'string' },
websiteUrl: { type: 'string' },
companyName: { type: 'string' },
version: { type: 'string' },
rating: { type: 'number' },
users: { type: 'number' },
updated: { type: 'number' },
created: { type: 'number' },
publicKey: { type: 'string' },
privateKey: { type: 'string' },
composerUrl: { type: 'string' },
rendererUrl: { type: 'string' },
revisions: {
type: 'array',
items: {
type: 'object',
},
},
}
}
export const selfSchema: JSONSchema = {
type: 'object',
properties: {
id: { type: 'string' },
name: { type: 'string' },
email: { type: 'string' },
about: { type: 'string' },
imageUrl: { type: 'string' },
coverImageUrl: { type: 'string' },
group: groupListingSchema,
requiresApproval: { type: 'boolean' },
privacy: { type: 'string' },
membership: { type: 'string' },
posts: { type: 'number' },
awards: { type: 'number' },
points: { type: 'number' },
created: { type: 'number' },
},
}
export const errorSchema: JSONSchema = {
type: 'object',
properties: {
message: { type: 'string' },
errors: {
type: 'array',
items: {
type: 'object',
properties: {
field: { type: 'string' },
message: { type: 'string' },
},
},
},
},
}