Skip to content

Commit

Permalink
feat: move system to modules + bump @oh/config - fix #98 (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
pagoru authored Oct 4, 2024
1 parent 4dbbb91 commit 2f43fff
Show file tree
Hide file tree
Showing 27 changed files with 37 additions and 40 deletions.
3 changes: 1 addition & 2 deletions app/server/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
"imports": {
"@oh/queue": "jsr:@oh/[email protected]",
"@oh/updater": "jsr:@oh/[email protected]",
"@oh/config": "jsr:@oh/config@1.0.1",
"@oh/config": "jsr:@oh/config@1.1.1",

"shared/": "./src/shared/",
"system/": "./src/system/",
"modules/": "./src/modules/",

"deno/": "https://deno.land/[email protected]/",
Expand Down
29 changes: 14 additions & 15 deletions app/server/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/server/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { System } from "./src/main.ts";
import { System } from "modules/system/main.ts";
import { load as loadEnv } from "loadenv";
import { getProcessedEnvs } from "shared/utils/main.ts";

Expand Down
1 change: 0 additions & 1 deletion app/server/src/main.ts

This file was deleted.

2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/account/login.request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";
import {
getIpFromRequest,
Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/account/logout.request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";

export const logoutRequest: RequestType = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getAccountFromRequest,
isAccountAuthValid,
} from "shared/utils/account.utils.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const deleteRequest: RequestType = {
method: RequestMethod.DELETE,
Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/account/otp/post.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getAccountFromRequest,
isAccountAuthValid,
} from "shared/utils/account.utils.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const postRequest: RequestType = {
method: RequestMethod.POST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getAccountFromRequest,
isAccountAuthValid,
} from "shared/utils/account.utils.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const verifyRequest: RequestType = {
method: RequestMethod.GET,
Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/account/ping.request.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { getIpFromRequest } from "shared/utils/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import { SERVER_SESSION_EXPIRE_TIME } from "shared/consts/main.ts";

export const pingRequest: RequestType = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";
import {
SESSION_EXPIRE_TIME,
Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/account/register.request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";
import {
PASSWORD_REGEX,
Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/account/verify.request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";

export const verifyRequest: RequestType = {
Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/admin/admin.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
isAccountAdminValid,
isAccountAuthValid,
} from "shared/utils/account.utils.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const accountGetRequest: RequestType = {
method: RequestMethod.GET,
Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/admin/update.request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RequestType } from "shared/types/request.types.ts";
import { RequestMethod } from "shared/enums/request.enum.ts";
import { isAccountAdminValid } from "shared/utils/account.utils.ts";
import { load as loadUpdater } from "modules/updater/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const updateGetRequest: RequestType = {
method: RequestMethod.GET,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";
import { SERVER_SESSION_EXPIRE_TIME } from "shared/consts/session.consts.ts";
import { getIpFromRequest } from "shared/utils/ip.utils.ts";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";
import { TICKET_EXPIRE_TIME } from "shared/consts/tickets.consts.ts";

Expand Down
2 changes: 1 addition & 1 deletion app/server/src/modules/api/v2/version.request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RequestType } from "shared/types/main.ts";
import { RequestMethod } from "shared/enums/main.ts";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const versionRequest: RequestType = {
method: RequestMethod.GET,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getContentType,
getCORSHeaders,
} from "shared/utils/main.ts";
import { System } from "system/main.ts";
import { System } from "./main.ts";

export const api = () => {
const load = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const captcha = () => {
const verify = async (sessionId: string): Promise<boolean> => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { System } from "system/main.ts";
import { System } from "./main.ts";

export const db = () => {
let kv;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const System = (() => {
const load = async (envs: Envs) => {
if (await loadUpdater(envs)) return;

$config = await $getConfig<ConfigTypes>(CONFIG_DEFAULT);
$config = await $getConfig<ConfigTypes>({ defaults: CONFIG_DEFAULT });
$envs = envs;

$tasks.load();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as OTPAuth from "otp";
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";

export const otp = () => {
const $getTOTP = (email: string, otpSecret: string): OTPAuth.TOTP =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import { TickerQueue } from "@oh/queue";
import { getServerSessionList } from "shared/utils/main.ts";

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/server/src/shared/utils/account.utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { System } from "system/main.ts";
import { System } from "modules/system/main.ts";
import * as bcrypt from "bcrypt";

export const getAccountFromRequest = async ({ headers }: Request) => {
Expand Down

0 comments on commit 2f43fff

Please sign in to comment.