184 lines · 5.4 KB
import { repoDb, stmt } from "./scoped-db";
import { registerLocator } from "./scoped-db/locators";
import { scopedId } from "./scoped-db/ids";
import { registerRepoRows } from "./issue-scope";
import { randomId } from "./crypto";
import { allocateIssueNumber } from "./issues";
import type { IssueRow } from "./issues";
import { addIssueEvent } from "./pulls";
import { repoReadOnlyReason, requireRepoAccess } from "./repos";
import type { RepoAccess } from "./repos";
import { forbidden, notFoundError } from "./errors";
import type { Permission, Viewer } from "~/lib/types";

const MAX_CONVERTED_COMMENTS = 500;

export type DiscussionRow = {
  id: string;
  repo_id: string;
  number: number;
  category_id: string;
  author_id: string;
  title: string;
  body: string;
  answer_id: string | null;
  upvotes: number;
  comments_count: number;
  locked: number;
  created_at: number;
  updated_at: number;
};

export type CategoryRow = {
  id: string;
  repo_id: string;
  name: string;
  emoji: string;
  description: string;
  answerable: number;
};