All files / src/routes index.ts

100% Statements 16/16
100% Branches 1/1
100% Functions 1/1
100% Lines 16/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 331x                               39x 39x   39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x  
import type { FastifyInstance } from "fastify";
import type { AppConfig } from "../config.js";
import { createAvatarStore } from "../storage/create-avatar-store.js";
import { createGpxContentStore } from "../storage/create-gpx-content-store.js";
import { accountRoutes } from "./account.js";
import { adminRoutes } from "./admin.js";
import { bikesRoutes } from "./bikes.js";
import { dictionariesRoutes } from "./dictionaries.js";
import { favoritesRoutes } from "./favorites.js";
import { geocodeRoutes } from "./geocode.js";
import { healthRoutes } from "./health.js";
import { likesRoutes } from "./likes.js";
import { profileRoutes } from "./profile.js";
import { statsRoutes } from "./stats.js";
import { tracksRoutes } from "./tracks.js";
 
export async function registerRoutes(app: FastifyInstance, config: AppConfig) {
  const gpxContentStore = createGpxContentStore(config);
  // Один и тот же R2-бакет хранит аватары и фото великов (разные префиксы ключей).
  const objectStore = createAvatarStore(config);
  await app.register(healthRoutes);
  await app.register(geocodeRoutes, { config });
  await app.register(profileRoutes, { config, avatarStore: objectStore });
  await app.register(likesRoutes, { config });
  await app.register(favoritesRoutes, { config });
  await app.register(bikesRoutes, { config, photoStore: objectStore });
  await app.register(accountRoutes, { config, objectStore });
  await app.register(adminRoutes, { config, objectStore });
  await app.register(dictionariesRoutes, { config });
  await app.register(statsRoutes, { config });
  await app.register(tracksRoutes, { config, gpxContentStore });
}