Skip to content

Commit

Permalink
updated modules description
Browse files Browse the repository at this point in the history
  • Loading branch information
skorphil committed Mar 9, 2024
1 parent ee4611d commit fc76713
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
16 changes: 13 additions & 3 deletions serverActions/appendRecord.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/*
Server action appends new record to mongoDB
Record transformed before being appended.
- Added quotes
- Added date
- Removed institutions with 'isDeleted:true'
*/

// TODO add error handling to ui
// TODO add success handling to UI
// TODO prevent adding multiple records per month. Ask to override

"use server";

import Ajv from "ajv";
Expand Down Expand Up @@ -62,9 +75,6 @@ export async function appendRecord(formData) {
if (!isFormDataValid) {
throw new Error(`Provided data has wrong structure: ${ajv.errorsText()}`);
}
// TODO add error handling to ui
// TODO add success handling to UI
// TODO prevent adding multiple records per month. Ask to override

const recordInstitutions = formData.institutions
.filter((institution) => !institution.isDeleted)
Expand Down
9 changes: 9 additions & 0 deletions serverActions/getLatestRecord.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
Server Action used to get latest record from mongodb.
Latest record then transfomed into format, which is used by react-hook-form in RecordForm
as defaultValues.
*/

// TODO pass errors to RecordForm

"use server";

import connect from "utils/mongooseConnect";
Expand Down
6 changes: 6 additions & 0 deletions serverActions/getQuotes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
Helper server action which used in appendRecord() get quotes based on app's base
curencies list(currencies we need to calculate to)
and currencies from record being saved
*/

"use server";

export async function getQuotes({ baseCurrencies, recordCurrencies }) {
Expand Down

0 comments on commit fc76713

Please sign in to comment.