Skip to content

Commit

Permalink
Added transaction description
Browse files Browse the repository at this point in the history
  • Loading branch information
thedanielforum committed Jul 4, 2022
1 parent 8168e82 commit 2d349fe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions components/HeaderNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const HeaderNavbar: React.FC = () => {
{
amount: parseCurrency(amount),
date: values.date,
description: values.description,
category: { id: values.category },
user: {
// @ts-ignore
Expand Down
13 changes: 13 additions & 0 deletions forms/TransactionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Loading from "components/Loading";
const validationSchema = Yup.object().shape({
amount: Yup.number().required("Required").nullable(),
date: Yup.date().required("Required").nullable(),
description: Yup.string().nullable(),
category: Yup.string().required("Required").nullable(),
});

Expand All @@ -40,6 +41,7 @@ export interface TransactionFormProps {
export type TransactionFormValues = {
amount: number;
date: Date;
description: String;
category: string;
type: "expense" | "income";
};
Expand Down Expand Up @@ -77,6 +79,17 @@ const TransactionForm: React.FC<TransactionFormProps> = (props) => {
/>
<Field as={Input} name="date" type="date" label="Date" />
<FormError name="date" errors={form.errors} touched={form.touched} />
<Field
as={Input}
name="description"
type="text"
label="Description"
/>
<FormError
name="description"
errors={form.errors}
touched={form.touched}
/>
{!data.queryCategory.length ? (
<div className="flex flex-row justify-center w-full">
<Link href="/account/categories">
Expand Down
13 changes: 4 additions & 9 deletions server/ikura.graphql
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Zef.SchemaVersion: v1
# Zef.Authentication: {"Algo": "HS256", "VerificationKey": "2c3432fba16d204318282d820959521efcd43fa1f3d75abb9ec31e902c65f981", "Audience": "ikura.app", "Header": "X-Auth-Token"}


type User
@auth(
add: """
Expand All @@ -15,10 +14,8 @@ type User
| collect])
"""
)
@upfetch(field: "email")
@hook(
onCreate: "userCreate"
) {
@upfetch(field: "email")
@hook(onCreate: "userCreate") {
sub: String
email: String! @unique @search
givenName: String
Expand Down Expand Up @@ -46,6 +43,7 @@ type Transaction
user: User @relation(rt: "User")
category: Category
amount: Int @search
description: String
date: DateTime @search
}

Expand All @@ -68,11 +66,8 @@ type Category
| collect])
"""
) {

user: User
transactions: [Transaction]
@incoming
@relation(rt: "Category")
transactions: [Transaction] @incoming @relation(rt: "Category")
name: String
icon: String
created: DateTime
Expand Down

1 comment on commit 2d349fe

@vercel
Copy link

@vercel vercel bot commented on 2d349fe Jul 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ikura – ./

ikura-git-main-zefhub.vercel.app
ikura-zefhub.vercel.app
ikura.vercel.app
www.ikura.app
ikura.app

Please sign in to comment.