mirror of https://github.com/buster-so/buster.git
feat: add type assertions for zValidator request handling
Co-Authored-By: Dallin Bentley <dallinbentley98@gmail.com>
This commit is contained in:
parent
bb80240c24
commit
e45c253344
|
@ -1,5 +1,6 @@
|
||||||
import { getUserOrganizationId } from '@buster/database';
|
import { getUserOrganizationId } from '@buster/database';
|
||||||
import {
|
import {
|
||||||
|
type InitiateOAuthRequest,
|
||||||
type InitiateOAuthResponse,
|
type InitiateOAuthResponse,
|
||||||
InitiateOAuthResponseSchema,
|
InitiateOAuthResponseSchema,
|
||||||
SlackError,
|
SlackError,
|
||||||
|
@ -45,7 +46,7 @@ export async function initiateOAuthHandler(c: Context): Promise<Response> {
|
||||||
throw new HTTPException(400, { message: 'Organization not found' });
|
throw new HTTPException(400, { message: 'Organization not found' });
|
||||||
}
|
}
|
||||||
|
|
||||||
const request = c.req.valid('json');
|
const request = c.req.valid('json') as InitiateOAuthRequest;
|
||||||
const metadata = request?.metadata;
|
const metadata = request?.metadata;
|
||||||
|
|
||||||
const enrichedMetadata = {
|
const enrichedMetadata = {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { getUserOrganizationId } from '@buster/database';
|
import { getUserOrganizationId } from '@buster/database';
|
||||||
import {
|
import {
|
||||||
SlackError,
|
SlackError,
|
||||||
|
type UpdateIntegrationRequest,
|
||||||
type UpdateIntegrationResponse,
|
type UpdateIntegrationResponse,
|
||||||
UpdateIntegrationResponseSchema,
|
UpdateIntegrationResponseSchema,
|
||||||
} from '@buster/server-shared/slack';
|
} from '@buster/server-shared/slack';
|
||||||
|
@ -22,7 +23,7 @@ export async function updateIntegrationHandler(c: Context): Promise<Response> {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const request = c.req.valid('json');
|
const request = c.req.valid('json') as UpdateIntegrationRequest;
|
||||||
|
|
||||||
const updateData: {
|
const updateData: {
|
||||||
defaultChannel?: { id: string; name: string };
|
defaultChannel?: { id: string; name: string };
|
||||||
|
|
Loading…
Reference in New Issue