GitFOSS
.ts
TypeScript
(application/typescript)
// std
import { PathLike } from "node:fs";
// 1st-party
import type { ServiceApiContract } from "@ethicdevs/react-monolith";
// 3rd-party
import type { FastifyRequest } from "fastify";
// generated via script[generate:prisma]
import type { Repository } from "@prisma/client";

export interface CreateRepositoryDTO {
  parentOrgSlug: string;
  repoSlug: string;
  repoData: Omit<
    Repository,
    "id" | "slug" | "createdAt" | "updatedAt" | "organizationId"
  >;
  repoInitFlags: {
    orgRepositoriesDir: PathLike;
    withBaseReadmeFile: boolean;
    withLicenseFile: string;
  };
}

export interface RepositoryServiceAPI extends ServiceApiContract {
  createRepository(dto: CreateRepositoryDTO): Promise<Repository>;
  getRepositoryExploreCollection(): Promise<Repository[]>;
  getHttpCloneUrl(repository: Repository): Promise<string>;
  getSshCloneUrl(repository: Repository): Promise<string>;
}

export interface RepositoryServiceDeps {
  request: FastifyRequest;
}