fix: nullable oauthId (#734)

This commit is contained in:
diced 2025-03-03 20:46:23 -08:00
parent a3aa1302e1
commit ab8c6a708a
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
3 changed files with 2 additions and 15 deletions

View file

@ -41,10 +41,6 @@ export default function Export3Details({ export3 }: { export3: Export3 }) {
const [envOpened, { toggle: toggleEnv }] = useDisclosure(false);
const [osOpened, { toggle: toggleOs }] = useDisclosure(false);
const lastStat = export3.stats.sort(
(a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
)[0];
const envRows = Object.entries(export3.request.env).map(([key, value]) => (
<Table.Tr key={key}>
<Table.Td>{key}</Table.Td>
@ -333,15 +329,6 @@ export default function Export3Details({ export3 }: { export3: Export3 }) {
/>
</Accordion.Panel>
</Accordion.Item>
<Accordion.Item value='Stats'>
<Accordion.Control icon={<IconGraph size='1rem' />}>Stats</Accordion.Control>
<Accordion.Panel>
There was a total of {export3.stats.length} stats entries. The last one recorded at{' '}
{new Date(lastStat.created_at).toLocaleString()} with the following data:
<HighlightCode language='json' code={JSON.stringify(lastStat.data, null, 2)} />
</Accordion.Panel>
</Accordion.Item>
</Accordion>
</>
);

View file

@ -195,7 +195,7 @@ export const export3Schema = z.object({
z.object({
provider: z.union([z.literal('DISCORD'), z.literal('GITHUB'), z.literal('GOOGLE')]),
username: z.string(),
oauth_id: z.string(),
oauth_id: z.string().nullable(),
access_token: z.string().nullable(),
refresh_token: z.string().nullable(),
}),

View file

@ -104,7 +104,7 @@ export default fastifyPlugin(
provider: provider.provider as any,
accessToken: provider.access_token!,
refreshToken: provider.refresh_token ?? null,
oauthId: provider.oauth_id!,
oauthId: provider.oauth_id ?? null,
username: provider.username!,
});
}