Skip to content

Commit 28ef9d8

Browse files
authored
Clean up Stately and migration stuff (#304)
1 parent 91ff681 commit 28ef9d8

63 files changed

Lines changed: 1007 additions & 8336 deletions

Some content is hidden

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

.env

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,4 @@ PGUSER=postgres
55
PGPASSWORD=postgres
66
PGSSL=false
77
JWT_SECRET=dummysecret
8-
VHOST=api.destinyitemmanager.com
9-
STATELY_STORE_ID=4691621389625154
10-
STATELY_REGION=us-west-2
11-
VHOST=api.destinyitemmanager.com
12-
STATELY_ACCESS_KEY="CAISRzBFAiEAhBwlEIYOXbLFzWyqZsTn3iLbyBUCjOVL8HzaAwDz6WkCIBf1QSVzt5VLV0VckmSsv2D3OHvnzHnctfTDDPifUOsDGgkI0sHq9_DVqAM"
8+
VHOST=api.destinyitemmanager.com

.github/workflows/pr-build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,3 @@ jobs:
3333

3434
- name: Test
3535
run: pnpm test
36-
env:
37-
STATELY_STORE_ID: ${{ vars.STATELY_STORE_ID}}
38-
STATELY_ACCESS_KEY: ${{ secrets.STATELY_ACCESS_KEY }}

api/db/apps-queries.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { ClientBase, QueryResult } from 'pg';
22
import { ApiApp } from '../shapes/app.js';
33
import { camelize, KeysToSnakeCase, TypesForKeys } from '../utils.js';
4-
import { transaction } from './index.js';
54

65
/**
76
* Get all registered apps.
@@ -16,14 +15,6 @@ export async function getAllApps(client: ClientBase): Promise<ApiApp[]> {
1615

1716
// TODO: Add a last modified column to apps and use that for more efficient syncing. This will require us to be able to disable apps rather than deleting them. And we need an index on that column.
1817

19-
export async function addAllApps(apps: ApiApp[]): Promise<void> {
20-
await transaction(async (client) => {
21-
for (const app of apps) {
22-
await insertApp(client, app);
23-
}
24-
});
25-
}
26-
2718
/**
2819
* Get an app by its ID.
2920
*/

api/db/loadout-share-queries.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -62,43 +62,6 @@ values ($1, $2, $3, $4, $5, $6, $7, $8, $9)`,
6262
return response;
6363
}
6464

65-
/**
66-
* Insert a loadout share, but ignore if the share ID already exists. This is
67-
* used for backfilling from Stately where we don't want to overwrite existing
68-
* shares, but we also don't want to fail the whole batch if there's a
69-
* duplicate.
70-
*/
71-
export async function addLoadoutShareIgnoring(
72-
client: ClientBase,
73-
bungieMembershipId: number | undefined,
74-
platformMembershipId: string,
75-
shareId: string,
76-
loadout: Loadout,
77-
viewCount = 0,
78-
): Promise<boolean> {
79-
const response = await client.query({
80-
name: 'add_loadout_share_ignoring',
81-
text: `insert into loadout_shares (id, membership_id, platform_membership_id, name, notes, class_type, items, parameters, view_count)
82-
values ($1, $2, $3, $4, $5, $6, $7, $8, $9) on conflict (id) do nothing`,
83-
values: [
84-
shareId,
85-
bungieMembershipId,
86-
platformMembershipId,
87-
loadout.name,
88-
loadout.notes,
89-
loadout.classType,
90-
{
91-
equipped: loadout.equipped.map(cleanItem),
92-
unequipped: loadout.unequipped.map(cleanItem),
93-
},
94-
loadout.parameters,
95-
viewCount,
96-
],
97-
});
98-
99-
return (response.rowCount ?? 0) > 1;
100-
}
101-
10265
/**
10366
* Touch the last_accessed_at and visits fields to keep track of access. This returns the loadout, if it exists.
10467
*/

0 commit comments

Comments
 (0)