MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / getByName

Method getByName

lib/models/expenses.ts:32–51  ·  view source on GitHub ↗
(userId: string, month: string, name: string)

Source from the content-addressed store, hash-verified

30 }
31
32 static async getByName(userId: string, month: string, name: string) {
33 const budget = (await db.query<Budget>(
34 sql`SELECT * FROM "bewcloud_budgets" WHERE "user_id" = $1 AND "month" = $2 AND LOWER("name") = LOWER($3)`,
35 [
36 userId,
37 month,
38 name,
39 ],
40 ))[0];
41
42 if (!budget) {
43 return null;
44 }
45
46 // Numeric values come as strings, so we need to convert them to numbers
47 return {
48 ...budget,
49 value: Number(budget.value),
50 };
51 }
52
53 static async getById(userId: string, id: string) {
54 const budget = (await db.query<Budget>(

Callers 2

createMethod · 0.45
updateMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected