Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Jun 21, 2024
1 parent 6a9e47a commit 72a16b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
16 changes: 0 additions & 16 deletions backend/src/lib/fn/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@ export const pick = <T extends object, TKeys extends keyof T>(obj: T, keys: TKey
);
};

/**
* Omit a list of properties from an object
* into a new object
*/
export const omit = <T extends object, TKeys extends keyof T>(obj: T, keys: TKeys[]): Omit<T, TKeys> => {
if (!obj) return {} as Omit<T, TKeys>;
return (Object.keys(obj) as TKeys[]).reduce(
(acc, key) => {
if (!keys.includes(key)) {
(acc as T)[key] = obj[key];
}
return acc;
},
{} as Omit<T, TKeys>
);
};
/**
* Removes (shakes out) undefined entries from an
* object. Optional second argument shakes out values
Expand Down
8 changes: 3 additions & 5 deletions backend/src/services/super-admin/super-admin-dal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ export const superAdminDALFactory = (db: TDbClient) => {
};

const updateById = async (id: string, data: TSuperAdminUpdate, tx?: Knex) => {
const updatedConfig = await superAdminOrm.transaction(async (trx) => {
await superAdminOrm.updateById(id, data, tx || trx);
const config = await findById(id, tx || trx);

return config;
const updatedConfig = await (superAdminOrm || tx).transaction(async (trx: Knex) => {
await superAdminOrm.updateById(id, data, trx);
return findById(id, trx);
});

return updatedConfig;
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/views/admin/DashboardPage/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ export const AdminDashboardPage = () => {
dropdownContainerClassName="bg-mineshaft-800"
defaultValue={field.value ?? " "}
onValueChange={(e) => {
if (e === " ") {
onChange(null);
} else {
onChange(e);
if (e === "EMPTY") {
onChange("");
return;
}
onChange(e);
}}
{...field}
>
<SelectItem value=" ">Select organization...</SelectItem>
<SelectItem value="EMPTY">Select organization...</SelectItem>
{organizations.data?.map((org) => (
<SelectItem key={org.id} value={org.id}>
{org.name}
Expand Down

0 comments on commit 72a16b7

Please sign in to comment.