-
Notifications
You must be signed in to change notification settings - Fork 64
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
Feat/add stream teams GitHub #1112
Merged
thomas-gerber
merged 6 commits into
faros-ai:main
from
jaorr95:feat/add-stream-teams-github
Aug 25, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
095cdde
fix: update json schema incidents for datadog
jaorr95 249565d
Add required id
jaorr95 4b72884
feat: add support for teams and team memberships streams
jaorr95 b373835
update teams and memberships.
jaorr95 c8edb3b
Merge branch 'main' into feat/add-stream-teams-github
tovbinm fcf373d
Merge branch 'main' into feat/add-stream-teams-github
thomas-gerber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
destinations/airbyte-faros-destination/src/converters/github/team_memberships.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {AirbyteRecord} from 'faros-airbyte-cdk'; | ||
import {toLower} from 'lodash'; | ||
|
||
import {DestinationModel, DestinationRecord} from '../converter'; | ||
import {GitHubConverter} from './common'; | ||
|
||
export class TeamMemberships extends GitHubConverter { | ||
readonly destinationModels: ReadonlyArray<DestinationModel> = [ | ||
'vcs_TeamMembership', | ||
'vcs_User', | ||
]; | ||
|
||
async convert( | ||
record: AirbyteRecord | ||
): Promise<ReadonlyArray<DestinationRecord>> { | ||
const source = this.streamName.source; | ||
const membership = record.record.data; | ||
const res: DestinationRecord[] = []; | ||
|
||
const team = { | ||
uid: toLower(membership.team_slug), | ||
source, | ||
}; | ||
const user = { | ||
uid: toLower(membership.username), | ||
source, | ||
}; | ||
|
||
res.push({ | ||
model: 'vcs_User', | ||
record: user, | ||
}); | ||
|
||
res.push({ | ||
model: 'vcs_TeamMembership', | ||
record: { | ||
user, | ||
team, | ||
}, | ||
}); | ||
|
||
return res; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
destinations/airbyte-faros-destination/src/converters/github/teams.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {AirbyteRecord} from 'faros-airbyte-cdk'; | ||
import {toLower} from 'lodash'; | ||
|
||
import {DestinationModel, DestinationRecord} from '../converter'; | ||
import {GitHubConverter} from './common'; | ||
|
||
export class Teams extends GitHubConverter { | ||
readonly destinationModels: ReadonlyArray<DestinationModel> = ['vcs_Team']; | ||
|
||
async convert( | ||
record: AirbyteRecord | ||
): Promise<ReadonlyArray<DestinationRecord>> { | ||
const source = this.streamName.source; | ||
const team = record.record.data; | ||
const res: DestinationRecord[] = []; | ||
|
||
res.push({ | ||
tovbinm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
model: 'vcs_Team', | ||
record: { | ||
name: team.name, | ||
uid: toLower(team.slug), | ||
description: team.description, | ||
source, | ||
}, | ||
}); | ||
|
||
return res; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In order to avoid writing the same entries, you can also a check similar to:
(same for all entries you write)