Skip to content

Commit

Permalink
Merge pull request #67 from GenieWizards/feat/update-deps
Browse files Browse the repository at this point in the history
deps: update to the latest versions⬆, sort imports🚨
  • Loading branch information
shivamvijaywargi authored Nov 30, 2024
2 parents 3400912 + 18aff1f commit 812036b
Show file tree
Hide file tree
Showing 31 changed files with 75 additions and 93 deletions.
Binary file modified bun.lockb
Binary file not shown.
24 changes: 23 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,29 @@ export default antfu(
"perfectionist/sort-imports": [
"error",
{
internalPattern: ["@/**"],
groups: [
["external-type", "builtin", "external"],
["internal-type", "internal"],
[
"parent-type",
"parent",
"sibling-type",
"sibling",
"index-type",
"index",
],
],
customGroups: {
type: {
internal: "^@/.*",
external: "^@(?!/).*",
},
value: {
internal: "^@/.*",
external: "^@(?!/).*",
},
},
newlinesBetween: "always",
},
],
"unicorn/filename-case": [
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@
"db:studio": "drizzle-kit studio --port=4000"
},
"dependencies": {
"@hono/zod-openapi": "^0.18.0",
"@hono/zod-openapi": "^0.18.3",
"@oslojs/crypto": "^1.0.1",
"@oslojs/encoding": "^1.1.0",
"@scalar/hono-api-reference": "^0.5.159",
"@scalar/hono-api-reference": "^0.5.162",
"drizzle-kit": "^0.28.1",
"drizzle-orm": "^0.36.1",
"drizzle-orm": "^0.36.4",
"drizzle-zod": "^0.5.1",
"hono": "^4.6.9",
"hono": "^4.6.12",
"hono-pino": "^0.7.0",
"pino": "^9.5.0",
"postgres": "^3.4.5",
"zod": "^3.23.8"
},
"devDependencies": {
"@antfu/eslint-config": "^3.8.0",
"@antfu/eslint-config": "^3.11.2",
"@types/bun": "latest",
"eslint": "^9.14.0",
"eslint-plugin-format": "^0.1.2",
"husky": "^9.1.6",
"eslint": "^9.16.0",
"eslint-plugin-format": "^0.1.3",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"pino-pretty": "^13.0.0"
},
Expand Down
4 changes: 1 addition & 3 deletions src/common/helpers/activity-log.helper.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { IActivityMetadata } from "@/modules/activities/activity.types";

import { db } from "@/db/adapter";
import { activityModel } from "@/db/schemas";
import type { IActivityMetadata } from "@/modules/activities/activity.types";

import type { ActivityTypeValues } from "../enums";

import { customLogger } from "../middlewares";

export async function logActivity(params: {
Expand Down
1 change: 0 additions & 1 deletion src/common/helpers/json-content-required.helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ZodSchema } from "../lib/types";

import { jsonContent } from "./json-content.helper";

function jsonContentRequired<T extends ZodSchema>(
Expand Down
3 changes: 1 addition & 2 deletions src/common/lib/configure-open-api.lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { apiReference } from "@scalar/hono-api-reference";

import env from "@/env";

import type { AppOpenAPI } from "./types";

import packageJSON from "../../../package.json";
import type { AppOpenAPI } from "./types";

export function configureOpenAPI(app: AppOpenAPI) {
app.doc("/doc", {
Expand Down
3 changes: 1 addition & 2 deletions src/common/lib/create-app.lib.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { OpenAPIHono } from "@hono/zod-openapi";

import type { AppBindings, AppOpenAPI } from "./types";

import {
notFoundMiddleware,
onErrorMiddleware,
pinoLogger,
serveEmojiFavicon,
} from "../middlewares";
import { defaultHook } from "../utils/default-hook.util";
import type { AppBindings, AppOpenAPI } from "./types";

export function createRouter() {
return new OpenAPIHono<AppBindings>({
Expand Down
2 changes: 0 additions & 2 deletions src/common/middlewares/auth.middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { MiddlewareHandler } from "hono";

import { getCookie } from "hono/cookie";

import * as HTTPStatusCodes from "@/common/utils/http-status-codes.util";

import type { AuthRole } from "../enums";

import { validateSessionToken } from "../utils/sessions.util";

export function authMiddleware(): MiddlewareHandler {
Expand Down
4 changes: 1 addition & 3 deletions src/common/middlewares/on-error.middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { ErrorHandler } from "hono";
import type { z } from "zod";

import { HTTPException } from "hono/http-exception";
import type { z } from "zod";
import { ZodError } from "zod";

import type { ErrorSchema } from "../schema/error-object.schema";

import * as HTTP_CODE from "../utils/http-status-codes.util";
import * as HTTP_PHRASE from "../utils/http-status-phrases.util";

Expand Down
5 changes: 2 additions & 3 deletions src/common/utils/sessions.util.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { encodeBase32LowerCaseNoPadding } from "@oslojs/encoding";
import { eq } from "drizzle-orm";

import type { TSelectSessionSchema } from "@/db/schemas/session.model";
import type { TSelectUserSchema } from "@/db/schemas/user.model";

import { db } from "@/db/adapter";
import type { TSelectSessionSchema } from "@/db/schemas/session.model";
import sessionModel from "@/db/schemas/session.model";
import type { TSelectUserSchema } from "@/db/schemas/user.model";
import userModel from "@/db/schemas/user.model";

export type SessionValidationResult =
Expand Down
3 changes: 1 addition & 2 deletions src/db/schemas/account.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { z } from "zod";

import { pgTable, timestamp, unique, varchar } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import userModel from "./user.model";

Expand Down
3 changes: 1 addition & 2 deletions src/db/schemas/activity.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { z } from "zod";

import {
jsonb,
pgEnum,
Expand All @@ -8,6 +6,7 @@ import {
varchar,
} from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import { activityTypeArr } from "@/common/enums";

Expand Down
3 changes: 1 addition & 2 deletions src/db/schemas/category.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { z } from "zod";

import { relations } from "drizzle-orm";
import {
boolean,
Expand All @@ -10,6 +8,7 @@ import {
varchar,
} from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import userModel, { lower } from "./user.model";

Expand Down
3 changes: 1 addition & 2 deletions src/db/schemas/expense.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { z } from "zod";

import {
pgEnum,
pgTable,
Expand All @@ -9,6 +7,7 @@ import {
varchar,
} from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import { splitTypeArr } from "@/common/enums";

Expand Down
3 changes: 1 addition & 2 deletions src/db/schemas/group.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { z } from "zod";

import { pgEnum, pgTable, timestamp, varchar } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import { GroupStatus, groupStatusArr } from "@/common/enums";

Expand Down
3 changes: 1 addition & 2 deletions src/db/schemas/session.model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { z } from "zod";

import { pgTable, timestamp, varchar } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import userModel from "./user.model";

Expand Down
3 changes: 1 addition & 2 deletions src/db/schemas/split.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { z } from "zod";

import {
boolean,
pgTable,
Expand All @@ -8,6 +6,7 @@ import {
varchar,
} from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import expenseModel from "./expense.model";
import userModel from "./user.model";
Expand Down
5 changes: 2 additions & 3 deletions src/db/schemas/user.model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { SQL } from "drizzle-orm";
import type { AnyPgColumn } from "drizzle-orm/pg-core";
import type { z } from "zod";

import { relations, sql } from "drizzle-orm";
import type { AnyPgColumn } from "drizzle-orm/pg-core";
import {
boolean,
pgEnum,
Expand All @@ -12,6 +10,7 @@ import {
varchar,
} from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";

import { AuthRoles, authRolesArr } from "@/common/enums";

Expand Down
6 changes: 2 additions & 4 deletions src/modules/activities/activity.handlers.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { AppRouteHandler } from "@/common/lib/types";

import { AuthRoles } from "@/common/enums";
import { generateMetadata } from "@/common/helpers/metadata.helper";
import type { AppRouteHandler } from "@/common/lib/types";
import * as HTTPStatusCodes from "@/common/utils/http-status-codes.util";

import type { TGetActivitiesRoute } from "./activity.routes";

import { getActivitiesRepository } from "./activity.repository";
import type { TGetActivitiesRoute } from "./activity.routes";
import { organizeActivities } from "./activity.utils";

export const getActivities: AppRouteHandler<TGetActivitiesRoute> = async (
Expand Down
5 changes: 1 addition & 4 deletions src/modules/activities/activity.repository.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import type { SQL } from "drizzle-orm";

import { and, asc, desc, sql } from "drizzle-orm";

import type { TInsertActivitySchema } from "@/db/schemas/activity.model";

import { db } from "@/db/adapter";
import type { TInsertActivitySchema } from "@/db/schemas/activity.model";
import activityModel from "@/db/schemas/activity.model";

import type { TActivityQuery } from "./activity.schema";

import { activitySortBy } from "./activity.utils";

export async function createActivityRepository(payload: TInsertActivitySchema) {
Expand Down
3 changes: 1 addition & 2 deletions src/modules/activities/activity.utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { TSelectActivitySchema } from "@/db/schemas/activity.model";

import { activityModel } from "@/db/schemas";
import type { TSelectActivitySchema } from "@/db/schemas/activity.model";

import type { IActivityMetadata } from "./activity.types";

Expand Down
16 changes: 7 additions & 9 deletions src/modules/auth/auth.handlers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { deleteCookie, setCookie } from "hono/cookie";

import type { AppRouteHandler } from "@/common/lib/types";

import { AuthRoles } from "@/common/enums";
import type { AppRouteHandler } from "@/common/lib/types";
import {
hashPassword,
verifyPasswordHash,
Expand All @@ -14,13 +13,6 @@ import { db } from "@/db/adapter";
import { accountModel, sessionModel, userModel } from "@/db/schemas";
import env from "@/env";

import type {
TLoggedInUserDetails,
TLoginRoute,
TLogoutRoute,
TRegisterRoute,
} from "./auth.routes";

import { getAccountRepository } from "../accounts/account.repository";
import {
createSessionReposiroty,
Expand All @@ -30,6 +22,12 @@ import {
getUserByEmailRepository,
getUserByIdRepository,
} from "../users/user.repository";
import type {
TLoggedInUserDetails,
TLoginRoute,
TLogoutRoute,
TRegisterRoute,
} from "./auth.routes";

export const register: AppRouteHandler<TRegisterRoute> = async (c) => {
const payload = c.req.valid("json");
Expand Down
20 changes: 9 additions & 11 deletions src/modules/categories/category.handlers.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import type { AppRouteHandler } from "@/common/lib/types";
import type { TSelectCategorySchema } from "@/db/schemas/category.model";

import { ActivityType, AuthRoles } from "@/common/enums";
import { logActivity } from "@/common/helpers/activity-log.helper";
import { generateMetadata } from "@/common/helpers/metadata.helper";
import type { AppRouteHandler } from "@/common/lib/types";
import * as HTTPStatusCodes from "@/common/utils/http-status-codes.util";

import type {
TCreateCategoryRoute,
TDeleteCategoryRoute,
TGetCategoriesRoute,
TGetCategoryRoute,
TUpdateCategoryRoute,
} from "./category.routes";
import type { TSelectCategorySchema } from "@/db/schemas/category.model";

import {
createCategoryRepository,
Expand All @@ -24,6 +15,13 @@ import {
getCategoryRepository,
updateCategoryByIdRepository,
} from "./category.repository";
import type {
TCreateCategoryRoute,
TDeleteCategoryRoute,
TGetCategoriesRoute,
TGetCategoryRoute,
TUpdateCategoryRoute,
} from "./category.routes";

export const createCategory: AppRouteHandler<TCreateCategoryRoute> = async (
c,
Expand Down
5 changes: 1 addition & 4 deletions src/modules/categories/category.repository.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import type { SQL } from "drizzle-orm";

import { and, asc, desc, eq, ilike, isNull, or, sql } from "drizzle-orm";

import type { TInsertCategorySchema } from "@/db/schemas/category.model";

import { db } from "@/db/adapter";
import { categoryModel } from "@/db/schemas";
import type { TInsertCategorySchema } from "@/db/schemas/category.model";
import { lower } from "@/db/schemas/user.model";

import type { TCategoryQuery } from "./category.schema";

import { categorySortBy } from "./category.util";

export async function createCategoryRepository(
Expand Down
8 changes: 3 additions & 5 deletions src/modules/group/group.handler.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import type { AppRouteHandler } from "@/common/lib/types";
import type { TSelectGroupSchema } from "@/db/schemas/group.model";

import { ActivityType } from "@/common/enums";
import { logActivity } from "@/common/helpers/activity-log.helper";
import type { AppRouteHandler } from "@/common/lib/types";
import * as HTTPStatusCodes from "@/common/utils/http-status-codes.util";

import type { TCreateGroupRoute, TDeleteGroupRoute } from "./group.routes";
import type { TSelectGroupSchema } from "@/db/schemas/group.model";

import {
createGroupRepository,
deleteGroupRepository,
} from "./group.repository";
import type { TCreateGroupRoute, TDeleteGroupRoute } from "./group.routes";

export const createGroup: AppRouteHandler<TCreateGroupRoute> = async (c) => {
const user = c.get("user");
Expand Down
Loading

0 comments on commit 812036b

Please sign in to comment.