-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# This is a combination of 16 commits.
# This is the 1st commit message: WIP # This is the commit message #2: Made `Funding` Codable. # This is the commit message #3: Return the funding from `fetchFunding`. # This is the commit message #4: Added `funding` column migration. # This is the commit message #5: Store the funding information in `Repository`. # This is the commit message #6: I’m not sure how these got removed! # This is the commit message #7: Tested ingestion with `fetchFunding`. # This is the commit message #8: Switched over to using the GraphQL query to fetch parsed funding links. # This is the commit message #9: Removed a bit of left over code from previous method and reduce noise in diff. # This is the commit message #10: Corrected the column definition for `fundingLinks`. # This is the commit message #11: Made the incoming funding link data from GitHub optional. # This is the commit message #12: Simplify repository.releases assignment # This is the commit message #13: Move FundingLink to top level type # This is the commit message #14: Extend test_fetchMetadata to cover funding links # This is the commit message #15: Simplify decoder # This is the commit message #16: Disconnect FundingLink type from GH specific internal representation
- Loading branch information
1 parent
1443bcc
commit 95c2dc6
Showing
10 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
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
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
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,30 @@ | ||
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import Fluent | ||
|
||
|
||
struct AddFundingToRepositories: AsyncMigration { | ||
func prepare(on database: Database) async throws { | ||
try await database.schema("repositories") | ||
.field("funding_links", .array(of: .json), .sql(.default("{}"))) | ||
.update() | ||
} | ||
|
||
func revert(on database: Database) async throws { | ||
try await database.schema("repositories") | ||
.deleteField("funding_links") | ||
.update() | ||
} | ||
} |
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,73 @@ | ||
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import Foundation | ||
|
||
|
||
struct FundingLink: Codable, Equatable { | ||
enum Platform: String, Codable { | ||
case communityBridge | ||
case customUrl | ||
case gitHub | ||
case issueHunt | ||
case koFi | ||
case lfxCrowdfunding | ||
case liberaPay | ||
case openCollective | ||
case otechie | ||
case patreon | ||
case tideLift | ||
} | ||
|
||
var platform: Platform | ||
var url: String | ||
} | ||
|
||
|
||
extension FundingLink { | ||
init(from node: Github.Metadata.FundingLinkNode) { | ||
platform = .init(from: node.platform) | ||
url = node.url | ||
} | ||
} | ||
|
||
|
||
extension FundingLink.Platform { | ||
init(from platform: Github.Metadata.FundingLinkNode.Platform) { | ||
switch platform { | ||
case .communityBridge: | ||
self = .communityBridge | ||
case .customUrl: | ||
self = .customUrl | ||
case .gitHub: | ||
self = .gitHub | ||
case .issueHunt: | ||
self = .issueHunt | ||
case .koFi: | ||
self = .koFi | ||
case .lfxCrowdfunding: | ||
self = .lfxCrowdfunding | ||
case .liberaPay: | ||
self = .liberaPay | ||
case .openCollective: | ||
self = .openCollective | ||
case .otechie: | ||
self = .otechie | ||
case .patreon: | ||
self = .patreon | ||
case .tideLift: | ||
self = .tideLift | ||
} | ||
} | ||
} |
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
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
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
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
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
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