Skip to content
Snippets Groups Projects
Commit 9afb2ff8 authored by DewanaGustavus's avatar DewanaGustavus
Browse files

refactor: router folder structure and interface

parent 6411f1e0
No related merge requests found
...@@ -13,8 +13,9 @@ datasource db { ...@@ -13,8 +13,9 @@ datasource db {
model User { model User {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
email String username String @unique
name String name String
email String @unique
password String password String
saldo Float @default(0.0) saldo Float @default(0.0)
histories History[] histories History[]
......
import express from "express"; import express from "express";
import type { Request, Response } from "express"; import type { Request, Response } from "express";
// import { body, validationResult } from "express-validator";
import * as HistoryServices from './history.service' import * as HistoryServices from './history.service'
......
import {db} from "../utils/db.server" import { History } from "../../interfaces/History";
import { HistoryDetail } from "../../interfaces/HistoryDetail";
import {db} from "../../utils/db.server"
type History = {
id: number,
user_id : number,
alamat_tujuan: string,
nama_penerima: string,
rating: number,
}
type HistoryDetail = {
id: number,
history_id : number,
product_name: string,
quantity: number,
}
export const getHistory = async (): Promise<History[]> => { export const getHistory = async (): Promise<History[]> => {
const user_id = 2; //ini buat temp aja karena auth belom dibuat const user_id = 2; //ini buat temp aja karena auth belom dibuat
......
File moved
import express, {Express, Request, Response} from "express"; import express, {Express, Request, Response} from "express";
import { HistoryRouter } from "./history/history.router"; import { HistoryRouter } from "./handler/history/history.router";
const app = express(); const app = express();
const port = 5000; const port = 5000;
......
export interface History {
id: number,
user_id : number,
alamat_tujuan: string,
nama_penerima: string,
rating: number,
}
export interface HistoryDetail {
id: number,
history_id : number,
product_name: string,
quantity: number,
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment