This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use server"; | |
| import { AppError, PlainAppError } from "@/errors"; | |
| import { MonthlyCategoryDetails } from "@/types"; | |
| import { createServersideClient } from "@/utils/supabase/server"; | |
| import { revalidatePath } from "next/cache"; | |
| // Updates the assigned amount for a category in a monthly budget | |
| export async function updateAssigned( | |
| monthlyBudgetId: number, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use server"; | |
| // fetch the data | |
| export async function getData() { | |
| const { data, error } = await supabase. | |
| // fethces data from db | |
| if (!error) { | |
| return data | |
| } | |
| // ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* User can add a transaction row. | |
| Date Handling: use only the date part of the ISO string to match | |
| schema's timestamp without time zone. | |
| We don't return the data inserted into the table, just null. | |
| */ | |
| // Inputs: | |
| // budgetId - the ID of the budget to add the transaction to (number) |