Skip to content

Commit

Permalink
feat: move to modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus64 committed Aug 12, 2024
1 parent 2d606a5 commit c700e6f
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 21 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getVersionTable, testaments } from "$/controllers/read.ts";
import { getVersionTable, testaments } from "./read.ts";
import { Context } from "hono";
import { connect } from "$/database/index.ts";
import { Version } from "$/constants.ts";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { connect } from "$/database/index.ts";
import { toValidName } from "$/controllers/read.ts";
import { toValidName } from "$/controllers/api/read.ts";


export const GetAcrossVersions = async (book: string, chapter: string, verse_num: string) => {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/controllers/user.ts → src/controllers/auth/user.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Context } from "hono";
import { getUser } from "$/middlewares/user.ts";
import { z } from "zod";
import { getCookie } from "jsr:@hono/hono/cookie";
import { getCookie } from "hono/cookie";

export const getUserInfo = async (c: Context) => {
const header = c.req.header().authorization;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/notes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Context } from "hono";
import { getUser } from "$/middlewares/user.ts";
import { getToken } from "$/middlewares/authorization.ts";
import { getCookie } from "jsr:@hono/hono/cookie";
import { getCookie } from "hono/cookie";

const getNotes = async (c: Context): Promise<Response> => {
const kv = await Deno.openKv();
Expand Down
18 changes: 9 additions & 9 deletions src/mod.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Hono } from "hono";
import "https://deno.land/x/[email protected]/load.ts";
import { cors } from "jsr:@hono/hono/cors";
import router_book from "$/routers/book.ts";
import router_auth from "$/routers/auth.ts";
import router_notes from "$/routers/notes.ts";
import router_book from "$/routers/api/book.ts";
import router_auth from "$/routers/auth/index.ts";
import router_notes from "$/routers/api/notes.ts";
import { isAuthenticated } from "$/middlewares/authorization.ts";
import router_user from "$/routers/user.ts";
import { getBooks, getTestamentBooks } from "$/controllers/book.ts";
import { deleteUser } from "$/controllers/user.ts";
import { router_read } from "$/routers/read.ts";
import { getVersions, versions } from "$/controllers/version.ts";
import { router_verses } from "$/routers/verses.ts";
import router_user from "$/routers/auth/user.ts";
import { getBooks, getTestamentBooks } from "$/controllers/api/book.ts";
import { deleteUser } from "$/controllers/auth/user.ts";
import { router_read } from "$/routers/api/read.ts";
import { getVersions, versions } from "$/controllers/api/version.ts";
import { router_verses } from "$/routers/api/verses.ts";

const DEV_ORIGINS: string[] = JSON.parse(Deno.env.get("ORIGINS") || "[]");
const origin = [
Expand Down
2 changes: 1 addition & 1 deletion src/routers/book.ts → src/routers/api/book.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Hono } from "hono";
import { validator } from "jsr:@hono/hono/validator";
import { getBookInfo } from "$/controllers/book.ts";
import { getBookInfo } from "$/controllers/api/book.ts";
import { invalidBookError } from "$/validators/book.ts";
import { existBook, getNameByAbbreviation, isAbbreviation } from "$/utils/book.ts";

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/routers/read.ts → src/routers/api/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
getOneVerseVersion,
SearchVersion,
validVersion,
} from "$/controllers/read.ts";
import { randomVerse } from "$/controllers/random.ts";
} from "$/controllers/api/read.ts";
import { randomVerse } from "$/controllers/api/random.ts";
import { invalidVersionResponse } from "$/validators/version.ts";
import { invalidBookError, invalidChapterError, validVerse } from "$/validators/book.ts";
import { Query, validQueries } from "$/validators/search.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/routers/verses.ts → src/routers/api/verses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Hono } from "hono";
import { existBook, getInfoBook } from "$/utils/book.ts";
import { invalidBookError, invalidChapterError, validVerse } from "$/validators/book.ts";
import { validator } from "jsr:@hono/hono/validator";
import { GetAcrossVersions } from "$/controllers/verses.ts";
import { GetAcrossVersions } from "$/controllers/api/verses.ts";

export const router_verses = new Hono();

Expand Down
2 changes: 1 addition & 1 deletion src/routers/auth.ts → src/routers/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Hono } from "hono";
import { login, logout, signup } from "$/controllers/auth.ts";
import { login, logout, signup } from "$/controllers/auth/index.ts";
import { z } from "zod";
import { validator } from "jsr:@hono/hono/validator";

Expand Down
2 changes: 1 addition & 1 deletion src/routers/user.ts → src/routers/auth/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Hono } from "hono";
import { getUserInfo } from "$/controllers/user.ts";
import { getUserInfo } from "$/controllers/auth/user.ts";

const router_user = new Hono();

Expand Down
2 changes: 1 addition & 1 deletion src/utils/book.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { books } from "$/constants.ts";
import { format, toValidName } from "$/controllers/read.ts";
import { format, toValidName } from "$/controllers/api/read.ts";

const oldTestamentbooks = books.filter((b) => {
return b.testament === "Antiguo Testamento";
Expand Down
2 changes: 1 addition & 1 deletion src/validators/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getVersions, validVersion } from "$/controllers/read.ts";
import { getVersions, validVersion } from "$/controllers/api/read.ts";
import { Context } from "hono";

export const invalidVersionResponse = (c: Context, version: string) => {
Expand Down

0 comments on commit c700e6f

Please sign in to comment.