mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 22:09:16 +01:00
refactor: ♻️ Always use explicit types in every function
This commit is contained in:
parent
54cea29ce9
commit
c1dcdc78ae
62 changed files with 359 additions and 226 deletions
|
|
@ -2,12 +2,12 @@ import { auth } from "@/api";
|
|||
import { proxyUrl } from "@/response";
|
||||
import { createRoute, z } from "@hono/zod-openapi";
|
||||
import { db } from "@versia/kit/db";
|
||||
import { eq } from "@versia/kit/drizzle";
|
||||
import { type SQL, eq } from "@versia/kit/drizzle";
|
||||
import { OpenIdAccounts, RolePermissions } from "@versia/kit/tables";
|
||||
import type { PluginType } from "~/plugins/openid";
|
||||
import { ErrorSchema } from "~/types/api";
|
||||
|
||||
export default (plugin: PluginType) => {
|
||||
export default (plugin: PluginType): void => {
|
||||
plugin.registerRoute("/api/v1/sso", (app) => {
|
||||
app.openapi(
|
||||
createRoute({
|
||||
|
|
@ -88,7 +88,7 @@ export default (plugin: PluginType) => {
|
|||
}
|
||||
|
||||
const account = await db.query.OpenIdAccounts.findFirst({
|
||||
where: (account, { eq, and }) =>
|
||||
where: (account, { eq, and }): SQL | undefined =>
|
||||
and(
|
||||
eq(account.userId, user.id),
|
||||
eq(account.issuerId, issuerId),
|
||||
|
|
@ -181,7 +181,7 @@ export default (plugin: PluginType) => {
|
|||
}
|
||||
|
||||
const account = await db.query.OpenIdAccounts.findFirst({
|
||||
where: (account, { eq, and }) =>
|
||||
where: (account, { eq, and }): SQL | undefined =>
|
||||
and(
|
||||
eq(account.userId, user.id),
|
||||
eq(account.issuerId, issuerId),
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { ErrorSchema } from "~/types/api";
|
|||
import type { PluginType } from "../../index.ts";
|
||||
import { oauthDiscoveryRequest, oauthRedirectUri } from "../../utils.ts";
|
||||
|
||||
export default (plugin: PluginType) => {
|
||||
export default (plugin: PluginType): void => {
|
||||
plugin.registerRoute("/api/v1/sso", (app) => {
|
||||
app.openapi(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue