Skip to content

[draft] add file export and github sync #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"jsonwebtoken": "^8.5.1",
"nanoid": "^3.0.0",
"nanoid-dictionary": "^4.3.0",
"octokit": "^2.0.14",
"prisma": "4.3.1",
"stompjs": "^2.3.3",
"uuid": "^9.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "githubAccessToken" TEXT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Repo" ADD COLUMN "githubRepo" TEXT;
22 changes: 12 additions & 10 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ model Profile {
}

model User {
id String @id
email String @unique
id String @id
email String @unique
// username is an optional value, because it might create barrier when user signup.
username String? @unique
firstname String
lastname String
username String? @unique
firstname String
lastname String
// A user might not have a password, if they login via OAuth.
hashedPassword String?
posts Post[]
profile Profile?
Repo Repo[] @relation("OWNER")
sharedRepos Repo[] @relation("COLLABORATOR")
hashedPassword String?
posts Post[]
profile Profile?
Repo Repo[] @relation("OWNER")
sharedRepos Repo[] @relation("COLLABORATOR")
githubAccessToken String?
}

model Repo {
Expand All @@ -58,6 +59,7 @@ model Repo {
podsId String[]
public Boolean @default(false)
collaborators User[] @relation("COLLABORATOR")
githubRepo String?
}

enum PodType {
Expand Down
19 changes: 19 additions & 0 deletions api/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ import {
loopKillInactiveRoutes as loopKillInactiveRoutes_k8s,
initRoutes as initRoutes_k8s,
} from "./spawner-k8s";
import {
deleteGitHubAccessToken,
getGitHubAccessToken,
getMyGitHubRepos,
githubExport,
linkedGitHubRepo,
linkGitHubRepo,
setGitHubAccessToken,
unlinkGitHubRepo,
} from "./resolver_git";

export const resolvers = {
Query: {
Expand All @@ -62,6 +72,10 @@ export const resolvers = {
: {
infoRuntime: infoRuntime_docker,
}),
// TODO this query is redundant, could just use /get/user
getGitHubAccessToken,
linkedGitHubRepo,
getMyGitHubRepos,
},
Mutation: {
signup,
Expand All @@ -86,6 +100,11 @@ export const resolvers = {
spawnRuntime: spawnRuntime_docker,
killRuntime: killRuntime_docker,
}),
githubExport,
setGitHubAccessToken,
deleteGitHubAccessToken,
linkGitHubRepo,
unlinkGitHubRepo,
},
};

Expand Down
Loading