feat(eom): lastSales, lastPurch added to be pulled with new template
This commit is contained in:
24
server/services/eom/controller/getLastPurchasesPrice.ts
Normal file
24
server/services/eom/controller/getLastPurchasesPrice.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { format } from "date-fns";
|
||||
import { query } from "../../sqlServer/prodSqlServer.js";
|
||||
import { lastPurchasePrice } from "../../sqlServer/querys/eom/lstPurchasePrice.js";
|
||||
|
||||
export const lastPurchase = async () => {
|
||||
const { data, error } = (await tryCatch(
|
||||
query(lastPurchasePrice, "Last purchase price")
|
||||
)) as any;
|
||||
|
||||
if (error) {
|
||||
return {
|
||||
success: false,
|
||||
message: "Error getting the last purchase price",
|
||||
data: error,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `Last purchase price for all av in the last 5 years`,
|
||||
data: data.data,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user