mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 17:49:09 +00:00
chore: sync from legacy redo
This commit is contained in:
parent
dde05c402e
commit
c4dda617b1
7 changed files with 67 additions and 2 deletions
18
packages/api/handlers/fetch-from-legacy.ts
Normal file
18
packages/api/handlers/fetch-from-legacy.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { respond } from '@roleypoly/api/utils/api-tools';
|
||||
import { asEditor } from '@roleypoly/api/utils/guild';
|
||||
import {
|
||||
fetchLegacyServer,
|
||||
transformLegacyGuild,
|
||||
} from '@roleypoly/api/utils/import-from-legacy';
|
||||
import { notFound } from '@roleypoly/api/utils/responses';
|
||||
|
||||
export const FetchFromLegacy = asEditor({}, (session, { guildID }) => async () => {
|
||||
const legacyGuild = await fetchLegacyServer(guildID);
|
||||
if (!legacyGuild) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
const transformedGuild = transformLegacyGuild(legacyGuild);
|
||||
|
||||
return respond(transformedGuild);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue