feature/research-di #1
@ -17,8 +17,6 @@ type customerDbResponse = {
|
||||
|
||||
export default class CustomerDbRepo implements CustomerRepo {
|
||||
async fetchList(query: string): Promise<Customer[]> {
|
||||
// This is equivalent to in fetch(..., {cache: 'no-store'}).
|
||||
connection()
|
||||
try {
|
||||
const data = await sql`
|
||||
SELECT
|
||||
|
@ -4,8 +4,10 @@ import serverDi from "@/feature/common/server-di";
|
||||
import { customerKey } from "@/feature/core/customer/customer-key";
|
||||
import Customer from "@/feature/core/customer/domain/entity/customer";
|
||||
import CustomerRepo, { customerRepoKey } from "@/feature/core/customer/domain/i-repo/customer-repo";
|
||||
import { connection } from "next/server";
|
||||
|
||||
export default async function fetchCustomersUsecase(query: string): Promise<Customer[]> {
|
||||
connection()
|
||||
const repo = serverDi(customerKey).resolve<CustomerRepo>(customerRepoKey)
|
||||
|
||||
return repo.fetchList(query)
|
||||
|
@ -10,7 +10,6 @@ export type RevenueDbResponse = {
|
||||
};
|
||||
export default class RevenueDbRepo implements RevenueRepo {
|
||||
async fetchRevenues(): Promise<Revenue[]> {
|
||||
// This is equivalent to in fetch(..., {cache: 'no-store'}).
|
||||
try {
|
||||
// Artificially delay a response for demo purposes.
|
||||
// Don't do this in production :)
|
||||
|
Loading…
x
Reference in New Issue
Block a user