|
1 | 1 | import { QueryTypes } from 'sequelize' |
2 | 2 |
|
3 | | -import { queryActivitiesCounter } from '@crowd/data-access-layer' |
4 | | -import { Counter, TinybirdClient } from '@crowd/data-access-layer/src/database' |
5 | | - |
6 | 3 | import { Repos } from '@/serverless/integrations/types/regularTypes' |
7 | 4 | import { GitHubStats } from '@/serverless/integrations/usecases/github/rest/getRemoteStats' |
8 | 5 |
|
@@ -86,56 +83,54 @@ class IntegrationProgressRepository { |
86 | 83 | return (result[0] as any).id as string |
87 | 84 | } |
88 | 85 |
|
89 | | - static async getDbStatsForGithub({ |
90 | | - repos, |
91 | | - segments, |
92 | | - }: { |
93 | | - repos: Repos |
94 | | - segments: string[] |
95 | | - }): Promise<GitHubStats> { |
96 | | - const tb = new TinybirdClient() |
97 | | - |
98 | | - const promises: Promise<{ data: Counter }>[] = [ |
99 | | - queryActivitiesCounter( |
100 | | - IntegrationProgressRepository.createPayloadWithActivityType(['star'], repos, segments), |
101 | | - tb, |
102 | | - ), |
103 | | - queryActivitiesCounter( |
104 | | - IntegrationProgressRepository.createPayloadWithActivityType(['unstar'], repos, segments), |
105 | | - tb, |
106 | | - ), |
107 | | - queryActivitiesCounter( |
108 | | - { |
109 | | - ...IntegrationProgressRepository.createPayloadWithActivityType(['fork'], repos, segments), |
110 | | - indirectFork: 1, |
111 | | - }, |
112 | | - tb, |
113 | | - ), |
114 | | - queryActivitiesCounter( |
115 | | - IntegrationProgressRepository.createPayloadWithActivityType( |
116 | | - ['issues-opened'], |
117 | | - repos, |
118 | | - segments, |
119 | | - ), |
120 | | - tb, |
121 | | - ), |
122 | | - queryActivitiesCounter( |
123 | | - IntegrationProgressRepository.createPayloadWithActivityType( |
124 | | - ['pull_request-opened'], |
125 | | - repos, |
126 | | - segments, |
127 | | - ), |
128 | | - tb, |
129 | | - ), |
130 | | - ] |
131 | | - |
132 | | - const result = await Promise.all(promises) |
| 86 | + static async getDbStatsForGithub(): Promise<GitHubStats> { |
| 87 | + // const tb = new TinybirdClient() |
| 88 | + |
| 89 | + // const promises: Promise<{ data: Counter }>[] = [ |
| 90 | + // queryActivitiesCounter( |
| 91 | + // IntegrationProgressRepository.createPayloadWithActivityType(['star'], repos, segments), |
| 92 | + // tb, |
| 93 | + // ), |
| 94 | + // queryActivitiesCounter( |
| 95 | + // IntegrationProgressRepository.createPayloadWithActivityType(['unstar'], repos, segments), |
| 96 | + // tb, |
| 97 | + // ), |
| 98 | + // queryActivitiesCounter( |
| 99 | + // { |
| 100 | + // ...IntegrationProgressRepository.createPayloadWithActivityType(['fork'], repos, segments), |
| 101 | + // indirectFork: 1, |
| 102 | + // }, |
| 103 | + // tb, |
| 104 | + // ), |
| 105 | + // queryActivitiesCounter( |
| 106 | + // IntegrationProgressRepository.createPayloadWithActivityType( |
| 107 | + // ['issues-opened'], |
| 108 | + // repos, |
| 109 | + // segments, |
| 110 | + // ), |
| 111 | + // tb, |
| 112 | + // ), |
| 113 | + // queryActivitiesCounter( |
| 114 | + // IntegrationProgressRepository.createPayloadWithActivityType( |
| 115 | + // ['pull_request-opened'], |
| 116 | + // repos, |
| 117 | + // segments, |
| 118 | + // ), |
| 119 | + // tb, |
| 120 | + // ), |
| 121 | + // ] |
| 122 | + |
| 123 | + // const result = await Promise.all(promises) |
133 | 124 |
|
134 | 125 | return { |
135 | | - stars: (result[0]?.data?.[0]?.count ?? 0) - (result[1]?.data?.[0]?.count ?? 0), |
136 | | - forks: result[2]?.data?.[0]?.count ?? 0, |
137 | | - totalIssues: result[3]?.data?.[0]?.count ?? 0, |
138 | | - totalPRs: result[4]?.data?.[0]?.count ?? 0, |
| 126 | + // stars: (result[0]?.data?.[0]?.count ?? 0) - (result[1]?.data?.[0]?.count ?? 0), |
| 127 | + // forks: result[2]?.data?.[0]?.count ?? 0, |
| 128 | + // totalIssues: result[3]?.data?.[0]?.count ?? 0, |
| 129 | + // totalPRs: result[4]?.data?.[0]?.count ?? 0, |
| 130 | + stars: 0, |
| 131 | + forks: 0, |
| 132 | + totalIssues: 0, |
| 133 | + totalPRs: 0, |
139 | 134 | } |
140 | 135 | } |
141 | 136 |
|
|
0 commit comments