-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[db/server] Link workspaces and projects #4846
Conversation
/werft run 👍 started the job as gitpod-build-at-workspace-project.2 |
382a2d9
to
3ae977b
Compare
public async findProjectsByTeam(teamId: string): Promise<Project[]> { | ||
const repo = await this.getRepo(); | ||
return repo.find({ teamId }); | ||
} | ||
|
||
public async createProject(name: string, cloneUrl: string, teamId: string, appInstallationId: string): Promise<Project> { | ||
const repo = await this.getRepo(); | ||
if (repo.findOne({ cloneUrl })) { | ||
throw new Error('A project with the same clone URL already exists'); | ||
} | ||
|
||
const project: Project = { | ||
id: uuidv4(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I like to decouple such creation logic from the DB, where it is hard to test etc. One example is to move this into a method Project.new
in project-protocol.ts
which takes a Without<Project, 'id' | 'creationTime'>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're talking about externalizing the creation of Project
object to be stored afterwards here.
then we can if id
included and add the check.
that sounds good.
@jankeromnes Left some remarks. I'm not sure I'm qualified to 'lgtm' before I did some more reading on "Teams & Projects" . 🙂 Update: See #4846 (comment) |
Co-authored-by: Jan Keromnes <[email protected]>
3ae977b
to
25213a2
Compare
@jankeromnes, please have another pass on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 😊 thanks!
export interface PrebuildInfo { | ||
id: string; | ||
teamId: string; | ||
project: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
projectId
would be more correct, but this is unimportant
LGTM label has been added. Git tree hash: 10962e03610ebe1d13d7b24d55c3e53ffb3711e6
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AlexTugarev, jankeromnes The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
We're now linking projects to workspaces as well.
Also in this PR:
d_b_project.cloneUrl
Without
type (replaceable withOmit
)ProjectDB.storeProject
andProject.create