Skip to content

Commit 6b94f51

Browse files
committed
Repository refactor (no need to split for educational purposes)
Header files comment now shows the TechTalk title
1 parent 2649db7 commit 6b94f51

File tree

49 files changed

+252
-369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+252
-369
lines changed

Examples/GlobantPlus/App/GlobantPlus/Application/ApplicationEnvironment.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// Environment.swift
3-
// Premiere
3+
// GlobantPlus
44
//
55
// Created by Adolfo Vera Blasco on 3/1/23.
66
//

Examples/GlobantPlus/App/GlobantPlus/Application/GlobantPlusApp.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// PremiereApp.swift
3-
// Premiere
3+
// GlobantPlus
44
//
55
// Created by Adolfo Vera Blasco on 3/1/23.
66
//

Examples/GlobantPlus/App/GlobantPlus/Data/Extensions/Int+Runtime.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// Int+Runtime.swift
3-
// Premiere
3+
// GlobantPlus
44
//
55
// Created by Adolfo Vera Blasco on 10/3/23.
66
//

Examples/GlobantPlus/App/GlobantPlus/Data/Network/AmazonAPI/AmazonFavoriteTrainingDELETERepository.swift

-15
This file was deleted.

Examples/GlobantPlus/App/GlobantPlus/Data/Network/AmazonAPI/AmazonFavoriteTrainingPOSTRepository.swift

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// AmazonFavoriteTrainingRepository.swift
3+
// GlobantPlus
4+
//
5+
// Created by Adolfo Vera Blasco on 15/3/23.
6+
//
7+
8+
import Foundation
9+
import Resty
10+
11+
final class AmazonFavoriteTrainingRepository: AmazonFavoriteTrainingBaseRepository, FavoriteTrainingRepository {
12+
func post(mediaID: Int, forUser userID: String) async throws {
13+
try await super.process(mediaID: mediaID, forUser: userID, httpMethod: .post)
14+
}
15+
16+
func delete(mediaID: Int, forUser userID: String) async throws {
17+
try await super.process(mediaID: mediaID, forUser: userID, httpMethod: .delete)
18+
}
19+
}

Examples/GlobantPlus/App/GlobantPlus/Data/Queues/AmazonSQS/Model/SQSActivity.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// SQSActivity.swift
3-
// Premiere
3+
// GlobantPlus
44
//
55
// Created by Adolfo Vera Blasco on 13/3/23.
66
//

Examples/GlobantPlus/App/GlobantPlus/Data/Queues/AmazonSQS/SQSActivityQueue.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// SQSActivityQueue.swift
3-
// Premiere
3+
// GlobantPlus
44
//
55
// Created by Adolfo Vera Blasco on 12/3/23.
66
//

Examples/GlobantPlus/App/GlobantPlus/Data/Queues/AmazonSQS/Trackable.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// Trackable.swift
3-
// Premiere
3+
// GlobantPlus
44
//
55
// Created by Adolfo Vera Blasco on 13/3/23.
66
//
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
//
2+
// TMDBPopularDocumentaryListRepository.swift
3+
// GlobantPlus
4+
//
5+
// Created by Adolfo Vera Blasco on 16/3/23.
6+
//
7+
8+
import Foundation
9+
import MovieDB
10+
11+
final class TMDBDashboardRepository: DashboardRepository {
12+
let apiClient: MovieDB
13+
14+
init() {
15+
self.apiClient = MovieDB(token: ApplicationEnvironment.shared.apiToken)
16+
}
17+
18+
func fetchPopularDocumentaries() async throws -> [TrendingItem] {
19+
let apiDocumentaries = try await apiClient.discoverDocumentaries(sortedBy: .popularity)
20+
21+
let trendingDocumentaries = apiDocumentaries.map({ apiDocumentary in
22+
var trendingDocumentary = TrendingItem(titled: apiDocumentary.title, ofType: .tv, withIdentifier: apiDocumentary.id)
23+
24+
trendingDocumentary.backdropPath = apiClient.makeBackdropUriFrom(path: apiDocumentary.backdropPath, ofSize: .regular)
25+
trendingDocumentary.posterPath = apiClient.makePosterUriFrom(path: apiDocumentary.posterPath, ofSize: .regular)
26+
27+
trendingDocumentary.popularity = apiDocumentary.popularity
28+
trendingDocumentary.voteCount = apiDocumentary.voteCount
29+
trendingDocumentary.voteAverage = apiDocumentary.voteAverage
30+
trendingDocumentary.overview = apiDocumentary.overview
31+
32+
return trendingDocumentary
33+
})
34+
35+
return trendingDocumentaries
36+
}
37+
38+
func fetchTrendingMovies() async throws -> [TrendingItem] {
39+
let apiMovies = try await apiClient.trendingMovies()
40+
41+
let trendingMovies = apiMovies.map({ apiMovie in
42+
var trendingMovie = TrendingItem(titled: apiMovie.title, ofType: .movie, withIdentifier: apiMovie.id)
43+
44+
trendingMovie.backdropPath = apiClient.makeBackdropUriFrom(path: apiMovie.backdropPath, ofSize: .regular)
45+
trendingMovie.posterPath = apiClient.makePosterUriFrom(path: apiMovie.posterPath, ofSize: .regular)
46+
47+
trendingMovie.popularity = apiMovie.popularity
48+
trendingMovie.voteCount = apiMovie.voteCount
49+
trendingMovie.voteAverage = apiMovie.voteAverage
50+
51+
trendingMovie.isAdultContent = apiMovie.isAdultContent
52+
trendingMovie.overview = apiMovie.overview
53+
54+
return trendingMovie
55+
})
56+
57+
return trendingMovies
58+
}
59+
60+
func fetchTrendingShows() async throws -> [TrendingItem] {
61+
async let apiShows = apiClient.trendingShows()
62+
async let tvGenres = apiClient.genres(for: .tv)
63+
64+
let trendingShows = try await apiShows.map({ apiShow in
65+
var trendingShow = TrendingItem(titled: apiShow.title, ofType: .tv, withIdentifier: apiShow.id)
66+
67+
trendingShow.backdropPath = apiClient.makeBackdropUriFrom(path: apiShow.backdropPath, ofSize: .regular)
68+
trendingShow.posterPath = apiClient.makePosterUriFrom(path: apiShow.posterPath, ofSize: .regular)
69+
70+
trendingShow.popularity = apiShow.popularity
71+
trendingShow.voteCount = apiShow.voteCount
72+
trendingShow.voteAverage = apiShow.voteAverage
73+
74+
trendingShow.isAdultContent = apiShow.isAdultContent
75+
trendingShow.overview = apiShow.overview
76+
77+
return trendingShow
78+
})
79+
80+
return trendingShows
81+
}
82+
}

Examples/GlobantPlus/App/GlobantPlus/Data/Repositories/Dashboard/TMDBPopularDocumentaryListRepository.swift

-37
This file was deleted.

Examples/GlobantPlus/App/GlobantPlus/Data/Repositories/Dashboard/TMDBTrendingMovieListRepository.swift

-39
This file was deleted.

Examples/GlobantPlus/App/GlobantPlus/Data/Repositories/Dashboard/TMDBTrendingShowListRepository.swift

-40
This file was deleted.

0 commit comments

Comments
 (0)