/
arseniy985
/
QuantaAI
Обзор
Документация
Войти
/
arseniy985
/
QuantaAI
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
src/internal/models/project-github/mapper.ts
48 строк
2 KB
Arseniy
feat: remove simpleChat and add git/GitHub integration
27 янв 2026, 13:16
27 янв 2026, 13:16
39df33e
Код
Авторство
О чём код?
import type { ProjectGitHub as PrismaProjectGitHub } from '@prisma/client'; import type { ProjectGitHub, CreateProjectGitHubInput, UpdateProjectGitHubInput } from './model'; export class ProjectGitHubMapper { static toDomain(record: PrismaProjectGitHub): ProjectGitHub { return { id: record.id, projectId: record.projectId, repoId: record.repoId, owner: record.owner, name: record.name, fullName: record.fullName, htmlUrl: record.htmlUrl, cloneUrl: record.cloneUrl, defaultBranch: record.defaultBranch ?? null, visibility: (record.visibility as ProjectGitHub['visibility']) ?? null, createdAt: record.createdAt, updatedAt: record.updatedAt, }; } static createToPrisma(input: CreateProjectGitHubInput) { return { projectId: input.projectId, repoId: input.repoId, owner: input.owner, name: input.name, fullName: input.fullName, htmlUrl: input.htmlUrl, cloneUrl: input.cloneUrl, defaultBranch: input.defaultBranch ?? null, visibility: input.visibility ?? null, }; } static updateToPrisma(input: UpdateProjectGitHubInput) { return { ...(input.repoId ? { repoId: input.repoId } : {}), ...(input.owner ? { owner: input.owner } : {}), ...(input.name ? { name: input.name } : {}), ...(input.fullName ? { fullName: input.fullName } : {}), ...(input.htmlUrl ? { htmlUrl: input.htmlUrl } : {}), ...(input.cloneUrl ? { cloneUrl: input.cloneUrl } : {}), ...(input.defaultBranch !== undefined ? { defaultBranch: input.defaultBranch } : {}), ...(input.visibility !== undefined ? { visibility: input.visibility } : {}), }; } }