Save to database #13
@@ -6,17 +6,19 @@ Order matters — later steps assume earlier ones are done.
|
|||||||
|
|
||||||
## 1. Audit cleanup
|
## 1. Audit cleanup
|
||||||
|
|
||||||
- [ ] **Remove `eightpoints/guzzle-bundle` + `idci/graphql-client-bundle`.**
|
- [x] **Remove `eightpoints/guzzle-bundle` + `idci/graphql-client-bundle`.**
|
||||||
They exist only to build one near-static GitHub GraphQL query string
|
They exist only to build one near-static GitHub GraphQL query string
|
||||||
(`GitHubProvider.php:59-74`); the bundle's own HTTP transport is already
|
(`GitHubProvider.php:59-74`); the bundle's own HTTP transport is already
|
||||||
bypassed (comment at `GitHubProvider.php:76-77`). Replace
|
bypassed (comment at `GitHubProvider.php:76-77`).
|
||||||
|
- [ ] Replace
|
||||||
`$graphqlClient->buildQuery(...)->getGraphQLQuery()` with a plain
|
`$graphqlClient->buildQuery(...)->getGraphQLQuery()` with a plain
|
||||||
`sprintf`/heredoc query string. Delete the two packages from
|
`sprintf`/heredoc query string. Delete the two packages from
|
||||||
`composer.json`, `config/bundles.php`, and delete
|
`composer.json`, `config/bundles.php`, and delete
|
||||||
`config/packages/eight_points_guzzle.yaml` +
|
`config/packages/eight_points_guzzle.yaml` +
|
||||||
`config/packages/idci_graphql_client.yaml`. Run `composer update` and
|
`config/packages/idci_graphql_client.yaml`. Run `composer update` and
|
||||||
commit the regenerated `composer.lock`.
|
commit the regenerated `composer.lock`.
|
||||||
- [ ] **Dedupe `baseUrl` normalization.** `GitLabProvider.php` (lines 41,
|
|
||||||
|
- [x] **Dedupe `baseUrl` normalization.** `GitLabProvider.php` (lines 41,
|
||||||
53) and `GiteaProvider.php` (lines 42, 54) each call
|
53) and `GiteaProvider.php` (lines 42, 54) each call
|
||||||
`rtrim($this->baseUrl..., '/')` twice — once in `ping()`, once in
|
`rtrim($this->baseUrl..., '/')` twice — once in `ping()`, once in
|
||||||
`fetch()`. Compute it once as a `private readonly string $baseUrl` in
|
`fetch()`. Compute it once as a `private readonly string $baseUrl` in
|
||||||
@@ -35,16 +37,16 @@ Order matters — later steps assume earlier ones are done.
|
|||||||
|
|
||||||
## 3. `ContributionStore` (SQLite via native PDO)
|
## 3. `ContributionStore` (SQLite via native PDO)
|
||||||
|
|
||||||
- [ ] New `src/Service/ContributionStore.php`. PDO SQLite, DB file at
|
- [x] New `src/Service/ContributionStore.php`. PDO SQLite, DB file at
|
||||||
`%kernel.project_dir%/var/data/contributions.db` (configurable
|
`%kernel.project_dir%/var/data/contributions.db` (configurable
|
||||||
constructor arg), table created lazily:
|
constructor arg), table created lazily:
|
||||||
```sql
|
```sql
|
||||||
CREATE TABLE IF NOT EXISTS contributions (
|
CREATE TABLE IF NOT EXISTS contributions (
|
||||||
provider TEXT NOT NULL,
|
provider TEXT NOT NULL,
|
||||||
date TEXT NOT NULL,
|
date TEXT NOT NULL,
|
||||||
count INTEGER NOT NULL,
|
count INTEGER NOT NULL CHECK (count >= 0),
|
||||||
PRIMARY KEY (provider, date)
|
PRIMARY KEY (provider, date)
|
||||||
);
|
) WITHOUT ROWID, STRICT;
|
||||||
```
|
```
|
||||||
- [ ] `latestDate(string $provider): ?string` — `SELECT MAX(date) WHERE provider = ?`.
|
- [ ] `latestDate(string $provider): ?string` — `SELECT MAX(date) WHERE provider = ?`.
|
||||||
- [ ] `merge(string $provider, array $dateCounts): void` — upsert via
|
- [ ] `merge(string $provider, array $dateCounts): void` — upsert via
|
||||||
|
|||||||
Reference in New Issue
Block a user