Fix lint and formatting issues
- Sort imports alphabetically in helpers.ts and router.ts - Simplify boolean comparison in users/update.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
* Admin procedure helpers - shared transformation functions
|
* Admin procedure helpers - shared transformation functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { OrgSites, Orgs, Users } from "@reviq/db-schema";
|
||||||
import type { Selectable } from "kysely";
|
import type { Selectable } from "kysely";
|
||||||
import type { Orgs, OrgSites, Users } from "@reviq/db-schema";
|
|
||||||
|
|
||||||
/** Transform org record to API response format */
|
/** Transform org record to API response format */
|
||||||
export const toOrgResponse = (org: Selectable<Orgs>) => ({
|
export const toOrgResponse = (org: Selectable<Orgs>) => ({
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ export const adminUsersUpdate = os.admin.users.update
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent superuser from demoting themselves
|
// Prevent superuser from demoting themselves
|
||||||
if (
|
if (!isSuperuser && normalizedEmail === context.user.email.toLowerCase()) {
|
||||||
isSuperuser === false &&
|
|
||||||
normalizedEmail === context.user.email.toLowerCase()
|
|
||||||
) {
|
|
||||||
throw new ORPCError("BAD_REQUEST", {
|
throw new ORPCError("BAD_REQUEST", {
|
||||||
message: "Cannot remove your own superuser status",
|
message: "Cannot remove your own superuser status",
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ORPCError } from "@orpc/server";
|
import { ORPCError } from "@orpc/server";
|
||||||
|
import { adminRoutes } from "./procedures/admin/_routes.js";
|
||||||
import { createLoginRequest as createLoginRequestHandler } from "./procedures/auth/create-login-request.js";
|
import { createLoginRequest as createLoginRequestHandler } from "./procedures/auth/create-login-request.js";
|
||||||
import { forgotPassword as forgotPasswordHandler } from "./procedures/auth/forgot-password.js";
|
import { forgotPassword as forgotPasswordHandler } from "./procedures/auth/forgot-password.js";
|
||||||
import { loginIfRequestIsCompleted as loginIfRequestIsCompletedHandler } from "./procedures/auth/login-if-completed.js";
|
import { loginIfRequestIsCompleted as loginIfRequestIsCompletedHandler } from "./procedures/auth/login-if-completed.js";
|
||||||
@@ -9,8 +10,11 @@ import { resendVerificationEmail as resendVerificationHandler } from "./procedur
|
|||||||
import { resetPassword as resetPasswordHandler } from "./procedures/auth/reset-password.js";
|
import { resetPassword as resetPasswordHandler } from "./procedures/auth/reset-password.js";
|
||||||
import { signup as signupHandler } from "./procedures/auth/signup.js";
|
import { signup as signupHandler } from "./procedures/auth/signup.js";
|
||||||
import { verifyEmail as verifyEmailHandler } from "./procedures/auth/verify-email.js";
|
import { verifyEmail as verifyEmailHandler } from "./procedures/auth/verify-email.js";
|
||||||
import { authMiddleware, loginRequestMiddleware, os } from "./procedures/base.js";
|
import {
|
||||||
import { adminRoutes } from "./procedures/admin/_routes.js";
|
authMiddleware,
|
||||||
|
loginRequestMiddleware,
|
||||||
|
os,
|
||||||
|
} from "./procedures/base.js";
|
||||||
import { meDelete } from "./procedures/me/delete.js";
|
import { meDelete } from "./procedures/me/delete.js";
|
||||||
import {
|
import {
|
||||||
getDeviceInfo,
|
getDeviceInfo,
|
||||||
|
|||||||
Reference in New Issue
Block a user