Skip to content

Commit af1be45

Browse files
committed
chore: import order
1 parent 85231d9 commit af1be45

File tree

14 files changed

+94
-93
lines changed

14 files changed

+94
-93
lines changed

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import dotenv from "dotenv";
21
import { logger } from "@/helpers/index.ts";
2+
import dotenv from "dotenv";
33

44
export const stages = ["development", "production", "test"] as const;
55

src/docs/openapi.ts

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1+
import { config } from "@/config.ts";
12
import { OpenAPIRegistry, OpenApiGeneratorV3 } from "@asteasolutions/zod-to-openapi";
23
import { z } from "zod";
3-
import { config } from "@/config.ts";
44
import {
5-
AccountSchema,
65
AccountCreateSchema,
7-
WorkspaceSchema,
8-
WorkspaceCreateSchema,
9-
ProfileSchema,
10-
ProfileUpdateSchema,
11-
MembershipSchema,
12-
MemberCreateSchema,
13-
SuccessResponseSchema,
14-
ErrorResponseSchema,
15-
PaginationSchema,
16-
PaginationQuerySchema,
17-
UuidParamSchema,
6+
AccountResponseDataSchema,
7+
AccountSchema,
8+
AccountStatusUpdateSchema,
9+
// Standardized response patterns
10+
AccountsWithPaginationDataSchema,
11+
AdminMembershipQuerySchema,
12+
// Query schemas
13+
AdminPaginationQuerySchema,
14+
AdminRoleUpdateSchema,
15+
AuditLogQuerySchema,
1816
AuditLogSchema,
17+
AuditLogStatsQuerySchema,
1918
AuditLogStatsSchema,
20-
// Parameter schemas
21-
UuidParamOnlySchema,
22-
WorkspaceHeaderSchema,
23-
UuidParamsWithMemberSchema,
19+
AuditLogWithDetailsSchema,
20+
AuditLogsWithPaginationDataSchema,
21+
AuthTokenDataSchema,
22+
CreateWorkspaceDataSchema,
23+
ErrorResponseSchema,
2424
// Request schemas
2525
LoginRequestSchema,
26-
SignupRequestSchema,
26+
MemberCreateSchema,
2727
MemberRoleUpdateSchema,
28-
AdminRoleUpdateSchema,
29-
AccountStatusUpdateSchema,
28+
MembershipResponseDataSchema,
29+
MembershipSchema,
30+
MembershipWithDetailsSchema,
31+
MembershipsWithPaginationDataSchema,
3032
// Response data schemas
3133
MessageResponseDataSchema,
32-
AccountResponseDataSchema,
33-
WorkspaceResponseDataSchema,
34+
PaginationQuerySchema,
35+
PaginationSchema,
3436
ProfileResponseDataSchema,
35-
MembershipResponseDataSchema,
36-
AuthTokenDataSchema,
37-
// Complex composite schemas
38-
WorkspaceMemberSchema,
39-
UserWorkspaceInfoSchema,
40-
WorkspaceWithMembersDataSchema,
41-
WorkspaceMembersDataSchema,
42-
CreateWorkspaceDataSchema,
43-
UserProfileDataSchema,
44-
// Query schemas
45-
AdminPaginationQuerySchema,
46-
AdminMembershipQuerySchema,
47-
AuditLogQuerySchema,
48-
AuditLogStatsQuerySchema,
37+
ProfileSchema,
38+
ProfileUpdateSchema,
39+
SignupRequestSchema,
4940
// Simple reference schemas
5041
SimpleAccountSchema,
5142
SimpleWorkspaceSchema,
52-
// Standardized response patterns
53-
AccountsWithPaginationDataSchema,
54-
WorkspacesWithPaginationDataSchema,
43+
SuccessResponseSchema,
44+
UserProfileDataSchema,
45+
UserWorkspaceInfoSchema,
46+
// Parameter schemas
47+
UuidParamOnlySchema,
48+
UuidParamSchema,
49+
UuidParamsWithMemberSchema,
50+
WorkspaceCreateSchema,
51+
WorkspaceHeaderSchema,
52+
// Complex composite schemas
53+
WorkspaceMemberSchema,
54+
WorkspaceMembersDataSchema,
55+
WorkspaceResponseDataSchema,
56+
WorkspaceSchema,
57+
WorkspaceWithMembersDataSchema,
5558
WorkspacesListDataSchema,
56-
AuditLogWithDetailsSchema,
57-
AuditLogsWithPaginationDataSchema,
58-
MembershipWithDetailsSchema,
59-
MembershipsWithPaginationDataSchema
59+
WorkspacesWithPaginationDataSchema
6060
} from "./openapi-schemas.ts";
6161

6262
const registry = new OpenAPIRegistry();

src/docs/swagger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import swaggerUi from "swagger-ui-express";
1+
import { config } from "@/config.ts";
2+
import { logger } from "@/helpers/logger.ts";
23
import type { Application } from "express";
4+
import swaggerUi from "swagger-ui-express";
35
import { generateOpenAPIDocument } from "./openapi.ts";
4-
import { logger } from "@/helpers/logger.ts";
5-
import { config } from "@/config.ts";
66

77
export const setupSwagger = (app: Application): void => {
88
// Only enable Swagger/OpenAPI documentation in development and test environments

src/handlers/accounts/accounts.handlers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { Request, Response } from "express";
2-
import { db } from "@/services/db/drizzle.ts";
3-
import { logger, gatewayResponse } from "@/helpers/index.ts";
4-
import { accounts, uuidSchema, type AccountSelectType, type AccountWithRelations } from "@/schema.ts";
5-
import { createDbAccount, getAccountWithRelations } from "./accounts.methods.ts";
61
import { HttpErrors, handleHttpError } from "@/helpers/HttpError.ts";
2+
import { gatewayResponse, logger } from "@/helpers/index.ts";
73
import { asyncHandler } from "@/helpers/request.ts";
4+
import { accounts, uuidSchema, type AccountSelectType, type AccountWithRelations } from "@/schema.ts";
5+
import { db } from "@/services/db/drizzle.ts";
6+
import type { Request, Response } from "express";
7+
import { createDbAccount, getAccountWithRelations } from "./accounts.methods.ts";
88

99
export const getAccounts = asyncHandler(async (_req: Request, res: Response): Promise<void> => {
1010
const result = await db.select().from(accounts).execute();

src/handlers/accounts/accounts.methods.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
type AccountWithRelations
1010
} from "@/schema.ts";
1111
import { db } from "@/services/db/drizzle.ts";
12-
import { eq } from "drizzle-orm";
1312
import { type DbTransaction } from "@/types/database.ts";
13+
import { eq } from "drizzle-orm";
1414

1515
export async function createDbAccount(account: AccountInsertType, tx?: DbTransaction): Promise<string> {
1616
const validationResult = accountInsertSchema.safeParse(account);

src/handlers/admin/admin.handlers.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { Request, Response } from "express";
2-
import { db } from "@/services/db/drizzle.ts";
3-
import { logger, gatewayResponse } from "@/helpers/index.ts";
4-
import { eq, sql, and } from "drizzle-orm";
5-
import { accounts, workspaces, workspaceMemberships } from "@/schema.ts";
6-
import { asyncHandler } from "@/helpers/request.ts";
7-
import { createAuditLog, auditHelpers, AUDIT_ACTIONS, ENTITY_TYPES } from "@/services/auditLog.ts";
81
import { HttpErrors, handleHttpError } from "@/helpers/HttpError.ts";
2+
import { gatewayResponse, logger } from "@/helpers/index.ts";
3+
import { asyncHandler } from "@/helpers/request.ts";
4+
import { accounts, workspaceMemberships, workspaces } from "@/schema.ts";
5+
import { AUDIT_ACTIONS, ENTITY_TYPES, auditHelpers, createAuditLog } from "@/services/auditLog.ts";
6+
import { db } from "@/services/db/drizzle.ts";
7+
import { and, eq, sql } from "drizzle-orm";
8+
import type { Request, Response } from "express";
99
// Removed workspace control imports - SuperAdmins monitor only
1010

1111
/**

src/handlers/auth/auth.handlers.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { supabase } from "@/services/supabase.ts";
2-
import type { NextFunction, Request, Response } from "express";
3-
import { logger, gatewayResponse } from "@/helpers/index.ts";
4-
import { createDbAccount } from "@/handlers/accounts/accounts.methods.ts";
5-
import type { User } from "@supabase/supabase-js";
6-
import { asyncHandler } from "@/helpers/request.ts";
71
import { LoginRequestSchema, SignupRequestSchema } from "@/docs/openapi-schemas.ts";
2+
import { createDbAccount } from "@/handlers/accounts/accounts.methods.ts";
83
import { HttpErrors, handleHttpError } from "@/helpers/HttpError.ts";
4+
import { gatewayResponse, logger } from "@/helpers/index.ts";
5+
import { asyncHandler } from "@/helpers/request.ts";
6+
import { supabase } from "@/services/supabase.ts";
7+
import type { User } from "@supabase/supabase-js";
8+
import type { NextFunction, Request, Response } from "express";
99

1010
export const signUpWithSupabase = async (email: string, password: string): Promise<User | Error> => {
1111
const { data, error } = await supabase.auth.signUp({
@@ -25,6 +25,7 @@ export const signUpWithSupabase = async (email: string, password: string): Promi
2525

2626
export const signUp = asyncHandler(async (req: Request, res: Response): Promise<void> => {
2727
const validation = SignupRequestSchema.safeParse(req.body);
28+
logger.info({ msg: "User signup attempt", body: req.body });
2829
if (!validation.success) {
2930
handleHttpError(
3031
HttpErrors.ValidationFailed(`Invalid request data: ${validation.error.message}`),

src/handlers/auth/auth.methods.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { logger } from "@/helpers/index.ts";
12
import jwt from "jsonwebtoken";
23
import { config } from "../../config.ts";
3-
import { logger } from "@/helpers/index.ts";
44

55
export const verifyToken = async (
66
token: string

src/handlers/me/me.handlers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { Request, Response } from "express";
2-
import { db } from "@/services/db/drizzle.ts";
3-
import { logger, gatewayResponse } from "@/helpers/index.ts";
4-
import { eq, and } from "drizzle-orm";
5-
import { accounts, workspaces, profiles, workspaceMemberships } from "@/schema.ts";
6-
import { asyncHandler } from "@/helpers/request.ts";
71
import { HttpErrors, handleHttpError } from "@/helpers/HttpError.ts";
2+
import { gatewayResponse, logger } from "@/helpers/index.ts";
3+
import { asyncHandler } from "@/helpers/request.ts";
4+
import { accounts, profiles, workspaceMemberships, workspaces } from "@/schema.ts";
5+
import { db } from "@/services/db/drizzle.ts";
6+
import { and, eq } from "drizzle-orm";
7+
import type { Request, Response } from "express";
88

99
/**
1010
* GET /me - Returns everything the frontend needs after login:

src/handlers/memberships/memberships.handlers.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import type { Request, Response } from "express";
1+
import { MemberCreateSchema, MemberRoleUpdateSchema } from "@/docs/openapi-schemas.ts";
2+
import { createDbProfile } from "@/handlers/profiles/profiles.methods.ts";
3+
import { HttpErrors, handleHttpError } from "@/helpers/HttpError.ts";
24
import { gatewayResponse, logger } from "@/helpers/index.ts";
3-
import { createMembership, checkMembership, isValidRole } from "./memberships.methods.ts";
45
import { asyncHandler } from "@/helpers/request.ts";
6+
import { accounts, profiles, uuidSchema, workspaceMemberships } from "@/schema.ts";
57
import { db } from "@/services/db/drizzle.ts";
6-
import { eq, and } from "drizzle-orm";
7-
import { accounts, profiles, workspaceMemberships, uuidSchema } from "@/schema.ts";
8-
import { createDbProfile } from "@/handlers/profiles/profiles.methods.ts";
9-
import { HttpErrors, handleHttpError } from "@/helpers/HttpError.ts";
10-
import { MemberCreateSchema, MemberRoleUpdateSchema } from "@/docs/openapi-schemas.ts";
8+
import { and, eq } from "drizzle-orm";
9+
import type { Request, Response } from "express";
10+
import { checkMembership, createMembership, isValidRole } from "./memberships.methods.ts";
1111

1212
export const createMembershipHandler = asyncHandler(async (req: Request, res: Response): Promise<void> => {
1313
const { workspaceId, accountId, role } = req.body;

0 commit comments

Comments
 (0)