Skip to content

Commit efacb90

Browse files
committed
chore: add missing responses.ts and fix seed
1 parent 9a20496 commit efacb90

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

server/api/uscf/player-search.post.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export default defineEventHandler(async (event) => {
66
const body = await readBody(event)
77
const { firstName, lastName, state } = body
88

9+
// get current epoch millis
10+
const now = Date.now()
11+
912
// Make the search body
1013
const searchBody = [[
1114
'SearchDisplay', 'run', {
@@ -14,7 +17,7 @@ export default defineEventHandler(async (event) => {
1417
display: 'Table',
1518
sort: [['sort_name', 'ASC']],
1619
limit: 50,
17-
seed: 1703773805368,
20+
seed: now,
1821
filters: { first_name: firstName, last_name: lastName, 'Contact_Address_contact_id_01.state_province_id': state.join(',') },
1922
afform: 'afsearchPlayerSearch1'
2023
}
@@ -45,7 +48,7 @@ export default defineEventHandler(async (event) => {
4548

4649
totalPlayers,
4750
results
48-
} as USCFPlayerSearchResponse
51+
} as unknown as USCFPlayerSearchResponse
4952
})
5053

5154
function parsePlayerRow(row: USCFAPISearchResponse['values'][0]) {

utils/responses.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Converts a given value to null if it is 0.
3+
*
4+
* @param val The value to convert
5+
*/
6+
export function zeroToNull(val: number) {
7+
return val === 0 ? null : val
8+
}

0 commit comments

Comments
 (0)