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

96 lines
2.5 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import { JSONSchema } from 'fastify'
  2. export const tokenResponseSchema: JSONSchema = {
  3. type: 'object',
  4. properties: {
  5. id: { type: 'string' },
  6. access: { type: 'string' },
  7. refresh: { type: 'string' },
  8. expires: { type: 'number' },
  9. },
  10. }
  11. export const postSchema: JSONSchema = {
  12. type: 'object',
  13. properties: {
  14. id: { type: 'string' },
  15. userId: { type: 'string' },
  16. text: { type: 'string' },
  17. cover: { type: 'string' },
  18. visible: { type: 'boolean' },
  19. created: { type: 'number' },
  20. },
  21. }
  22. export const userSchema: JSONSchema = {
  23. type: 'object',
  24. properties: {
  25. id: { type: 'string' },
  26. name: { type: 'string' },
  27. imageUrl: { type: 'string' },
  28. coverImageUrl: { type: 'string' },
  29. group: {
  30. type: 'object',
  31. properties: {
  32. id: { type: 'string' },
  33. name: { type: 'string' },
  34. imageUrl: { type: 'string' },
  35. coverImageUrl: { type: 'string' },
  36. },
  37. },
  38. created: { type: 'number' },
  39. subscription: { type: 'string' },
  40. membership: { type: 'string' },
  41. },
  42. }
  43. export const awardSchema: JSONSchema = {
  44. type: 'object',
  45. properties: {
  46. userId: { type: 'string' },
  47. imageUrl: { type: 'string' },
  48. text: { type: 'string' },
  49. userText: { type: 'string' },
  50. created: { type: 'number' },
  51. },
  52. }
  53. export const groupListingSchema: JSONSchema = {
  54. type: 'object',
  55. properties: {
  56. id: { type: 'string' },
  57. name: { type: 'string' },
  58. about: { type: 'string' },
  59. imageUrl: { type: 'string' },
  60. coverImageUrl: { type: 'string' },
  61. requiresApproval: { type: 'boolean' },
  62. members: { type: 'number' },
  63. posts: { type: 'number' },
  64. awards: { type: 'number' },
  65. points: { type: 'number' },
  66. created: { type: 'number' },
  67. membership: { type: 'string' },
  68. latestAwards: {
  69. type: 'array',
  70. items: awardSchema,
  71. },
  72. },
  73. }
  74. export const errorSchema: JSONSchema = {
  75. type: 'object',
  76. properties: {
  77. message: { type: 'string' },
  78. errors: {
  79. type: 'array',
  80. items: {
  81. type: 'object',
  82. properties: {
  83. field: { type: 'string' },
  84. message: { type: 'string' },
  85. },
  86. },
  87. },
  88. },
  89. }