Skip to content

Commit

Permalink
Merge pull request #8 from AgricHub/amplication-agric-hub-tests
Browse files Browse the repository at this point in the history
chore(Amplication): Update Generated Code
  • Loading branch information
danielmarv authored Oct 22, 2023
2 parents 2364c42 + 45f6991 commit a211d77
Show file tree
Hide file tree
Showing 79 changed files with 1,819 additions and 33 deletions.
11 changes: 11 additions & 0 deletions apps/agric-hub-tests-admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import { ProductList } from "./product/ProductList";
import { ProductCreate } from "./product/ProductCreate";
import { ProductEdit } from "./product/ProductEdit";
import { ProductShow } from "./product/ProductShow";
import { OrganizationList } from "./organization/OrganizationList";
import { OrganizationCreate } from "./organization/OrganizationCreate";
import { OrganizationEdit } from "./organization/OrganizationEdit";
import { OrganizationShow } from "./organization/OrganizationShow";
import { jwtAuthProvider } from "./auth-provider/ra-auth-jwt";

const App = (): React.ReactElement => {
Expand Down Expand Up @@ -86,6 +90,13 @@ const App = (): React.ReactElement => {
create={ProductCreate}
show={ProductShow}
/>
<Resource
name="Organization"
list={OrganizationList}
edit={OrganizationEdit}
create={OrganizationCreate}
show={OrganizationShow}
/>
</Admin>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions apps/agric-hub-tests-admin/src/address/AddressCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const AddressCreate = (props: CreateProps): React.ReactElement => {
<TextInput label="Address 1" source="address_1" />
<TextInput label="Address 2" source="address_2" />
<TextInput label="City" source="city" />
<TextInput label="Country" source="country" />
<ReferenceArrayInput
source="customers"
reference="Customer"
Expand Down
1 change: 1 addition & 0 deletions apps/agric-hub-tests-admin/src/address/AddressEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const AddressEdit = (props: EditProps): React.ReactElement => {
<TextInput label="Address 1" source="address_1" />
<TextInput label="Address 2" source="address_2" />
<TextInput label="City" source="city" />
<TextInput label="Country" source="country" />
<ReferenceArrayInput
source="customers"
reference="Customer"
Expand Down
1 change: 1 addition & 0 deletions apps/agric-hub-tests-admin/src/address/AddressList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const AddressList = (props: ListProps): React.ReactElement => {
<TextField label="Address 1" source="address_1" />
<TextField label="Address 2" source="address_2" />
<TextField label="City" source="city" />
<TextField label="Country" source="country" />
<DateField source="createdAt" label="Created At" />
<TextField label="ID" source="id" />
<TextField label="State" source="state" />
Expand Down
2 changes: 2 additions & 0 deletions apps/agric-hub-tests-admin/src/address/AddressShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const AddressShow = (props: ShowProps): React.ReactElement => {
<TextField label="Address 1" source="address_1" />
<TextField label="Address 2" source="address_2" />
<TextField label="City" source="city" />
<TextField label="Country" source="country" />
<DateField source="createdAt" label="Created At" />
<TextField label="ID" source="id" />
<TextField label="State" source="state" />
Expand All @@ -40,6 +41,7 @@ export const AddressShow = (props: ShowProps): React.ReactElement => {
</ReferenceField>
<TextField label="Country" source="country" />
<DateField source="createdAt" label="Created At" />
<TextField label="CustomerType" source="customerType" />
<TextField label="Email" source="email" />
<TextField label="First Name" source="firstName" />
<TextField label="ID" source="id" />
Expand Down
1 change: 1 addition & 0 deletions apps/agric-hub-tests-admin/src/api/address/Address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type Address = {
address_1: string | null;
address_2: string | null;
city: string | null;
country: string | null;
createdAt: Date;
customers?: Array<Customer>;
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type AddressCreateInput = {
address_1?: string | null;
address_2?: string | null;
city?: string | null;
country?: string | null;
customers?: CustomerCreateNestedManyWithoutAddressesInput;
state?: string | null;
zip?: number | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type AddressOrderByInput = {
address_1?: SortOrder;
address_2?: SortOrder;
city?: SortOrder;
country?: SortOrder;
createdAt?: SortOrder;
id?: SortOrder;
state?: SortOrder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type AddressUpdateInput = {
address_1?: string | null;
address_2?: string | null;
city?: string | null;
country?: string | null;
customers?: CustomerUpdateManyWithoutAddressesInput;
state?: string | null;
zip?: number | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type AddressWhereInput = {
address_1?: StringNullableFilter;
address_2?: StringNullableFilter;
city?: StringNullableFilter;
country?: StringNullableFilter;
customers?: CustomerListRelationFilter;
id?: StringFilter;
state?: StringNullableFilter;
Expand Down
1 change: 1 addition & 0 deletions apps/agric-hub-tests-admin/src/api/customer/Customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type Customer = {
address?: Address | null;
country: string | null;
createdAt: Date;
customerType?: "Seller" | "Buyer";
email: string | null;
firstName: string | null;
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { OrderCreateNestedManyWithoutCustomersInput } from "./OrderCreateNestedM
export type CustomerCreateInput = {
address?: AddressWhereUniqueInput | null;
country?: string | null;
customerType: "Seller" | "Buyer";
email?: string | null;
firstName?: string | null;
lastName?: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type CustomerOrderByInput = {
addressId?: SortOrder;
country?: SortOrder;
createdAt?: SortOrder;
customerType?: SortOrder;
email?: SortOrder;
firstName?: SortOrder;
id?: SortOrder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { OrderUpdateManyWithoutCustomersInput } from "./OrderUpdateManyWithoutCu
export type CustomerUpdateInput = {
address?: AddressWhereUniqueInput | null;
country?: string | null;
customerType?: "Seller" | "Buyer";
email?: string | null;
firstName?: string | null;
lastName?: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { OrderListRelationFilter } from "../order/OrderListRelationFilter";
export type CustomerWhereInput = {
address?: AddressWhereUniqueInput;
country?: StringNullableFilter;
customerType?: "Seller" | "Buyer";
email?: StringNullableFilter;
firstName?: StringNullableFilter;
id?: StringFilter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum EnumCustomerCustomerType {
Seller = "Seller",
Buyer = "Buyer",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OrganizationCreateInput } from "./OrganizationCreateInput";

export type CreateOrganizationArgs = {
data: OrganizationCreateInput;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OrganizationWhereUniqueInput } from "./OrganizationWhereUniqueInput";

export type DeleteOrganizationArgs = {
where: OrganizationWhereUniqueInput;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type Organization = {
createdAt: Date;
email: string | null;
id: string;
location: string | null;
name: string;
updatedAt: Date;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OrganizationWhereInput } from "./OrganizationWhereInput";

export type OrganizationCountArgs = {
where?: OrganizationWhereInput;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type OrganizationCreateInput = {
email?: string | null;
location?: string | null;
name: string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { OrganizationWhereInput } from "./OrganizationWhereInput";
import { OrganizationOrderByInput } from "./OrganizationOrderByInput";

export type OrganizationFindManyArgs = {
where?: OrganizationWhereInput;
orderBy?: Array<OrganizationOrderByInput>;
skip?: number;
take?: number;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OrganizationWhereUniqueInput } from "./OrganizationWhereUniqueInput";

export type OrganizationFindUniqueArgs = {
where: OrganizationWhereUniqueInput;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { OrganizationWhereInput } from "./OrganizationWhereInput";

export type OrganizationListRelationFilter = {
every?: OrganizationWhereInput;
some?: OrganizationWhereInput;
none?: OrganizationWhereInput;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { SortOrder } from "../../util/SortOrder";

export type OrganizationOrderByInput = {
createdAt?: SortOrder;
email?: SortOrder;
id?: SortOrder;
location?: SortOrder;
name?: SortOrder;
updatedAt?: SortOrder;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type OrganizationUpdateInput = {
email?: string | null;
location?: string | null;
name?: string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StringNullableFilter } from "../../util/StringNullableFilter";
import { StringFilter } from "../../util/StringFilter";

export type OrganizationWhereInput = {
email?: StringNullableFilter;
id?: StringFilter;
location?: StringNullableFilter;
name?: StringFilter;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type OrganizationWhereUniqueInput = {
id: string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { OrganizationWhereUniqueInput } from "./OrganizationWhereUniqueInput";
import { OrganizationUpdateInput } from "./OrganizationUpdateInput";

export type UpdateOrganizationArgs = {
where: OrganizationWhereUniqueInput;
data: OrganizationUpdateInput;
};
10 changes: 10 additions & 0 deletions apps/agric-hub-tests-admin/src/customer/CustomerCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ export const CustomerCreate = (props: CreateProps): React.ReactElement => {
<SelectInput optionText={AddressTitle} />
</ReferenceInput>
<TextInput label="Country" source="country" />
<SelectInput
source="customerType"
label="CustomerType"
choices={[
{ label: "Seller", value: "Seller" },
{ label: "Buyer", value: "Buyer" },
]}
optionText="label"
optionValue="value"
/>
<TextInput label="Email" source="email" type="email" />
<TextInput label="First Name" source="firstName" />
<TextInput label="Last Name" source="lastName" />
Expand Down
10 changes: 10 additions & 0 deletions apps/agric-hub-tests-admin/src/customer/CustomerEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ export const CustomerEdit = (props: EditProps): React.ReactElement => {
<SelectInput optionText={AddressTitle} />
</ReferenceInput>
<TextInput label="Country" source="country" />
<SelectInput
source="customerType"
label="CustomerType"
choices={[
{ label: "Seller", value: "Seller" },
{ label: "Buyer", value: "Buyer" },
]}
optionText="label"
optionValue="value"
/>
<TextInput label="Email" source="email" type="email" />
<TextInput label="First Name" source="firstName" />
<TextInput label="Last Name" source="lastName" />
Expand Down
1 change: 1 addition & 0 deletions apps/agric-hub-tests-admin/src/customer/CustomerList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const CustomerList = (props: ListProps): React.ReactElement => {
</ReferenceField>
<TextField label="Country" source="country" />
<DateField source="createdAt" label="Created At" />
<TextField label="CustomerType" source="customerType" />
<TextField label="Email" source="email" />
<TextField label="First Name" source="firstName" />
<TextField label="ID" source="id" />
Expand Down
1 change: 1 addition & 0 deletions apps/agric-hub-tests-admin/src/customer/CustomerShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const CustomerShow = (props: ShowProps): React.ReactElement => {
</ReferenceField>
<TextField label="Country" source="country" />
<DateField source="createdAt" label="Created At" />
<TextField label="CustomerType" source="customerType" />
<TextField label="Email" source="email" />
<TextField label="First Name" source="firstName" />
<TextField label="ID" source="id" />
Expand Down
14 changes: 14 additions & 0 deletions apps/agric-hub-tests-admin/src/organization/OrganizationCreate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from "react";
import { Create, SimpleForm, CreateProps, TextInput } from "react-admin";

export const OrganizationCreate = (props: CreateProps): React.ReactElement => {
return (
<Create {...props}>
<SimpleForm>
<TextInput label="Email" source="email" type="email" />
<TextInput label="Location" source="location" />
<TextInput label="Name" source="name" />
</SimpleForm>
</Create>
);
};
14 changes: 14 additions & 0 deletions apps/agric-hub-tests-admin/src/organization/OrganizationEdit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as React from "react";
import { Edit, SimpleForm, EditProps, TextInput } from "react-admin";

export const OrganizationEdit = (props: EditProps): React.ReactElement => {
return (
<Edit {...props}>
<SimpleForm>
<TextInput label="Email" source="email" type="email" />
<TextInput label="Location" source="location" />
<TextInput label="Name" source="name" />
</SimpleForm>
</Edit>
);
};
24 changes: 24 additions & 0 deletions apps/agric-hub-tests-admin/src/organization/OrganizationList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from "react";
import { List, Datagrid, ListProps, DateField, TextField } from "react-admin";
import Pagination from "../Components/Pagination";

export const OrganizationList = (props: ListProps): React.ReactElement => {
return (
<List
{...props}
bulkActionButtons={false}
title={"Organizations"}
perPage={50}
pagination={<Pagination />}
>
<Datagrid rowClick="show">
<DateField source="createdAt" label="Created At" />
<TextField label="Email" source="email" />
<TextField label="ID" source="id" />
<TextField label="Location" source="location" />
<TextField label="Name" source="name" />
<DateField source="updatedAt" label="Updated At" />
</Datagrid>
</List>
);
};
23 changes: 23 additions & 0 deletions apps/agric-hub-tests-admin/src/organization/OrganizationShow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from "react";
import {
Show,
SimpleShowLayout,
ShowProps,
DateField,
TextField,
} from "react-admin";

export const OrganizationShow = (props: ShowProps): React.ReactElement => {
return (
<Show {...props}>
<SimpleShowLayout>
<DateField source="createdAt" label="Created At" />
<TextField label="Email" source="email" />
<TextField label="ID" source="id" />
<TextField label="Location" source="location" />
<TextField label="Name" source="name" />
<DateField source="updatedAt" label="Updated At" />
</SimpleShowLayout>
</Show>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Organization as TOrganization } from "../api/organization/Organization";

export const ORGANIZATION_TITLE_FIELD = "name";

export const OrganizationTitle = (record: TOrganization): string => {
return record.name?.toString() || String(record.id);
};
2 changes: 1 addition & 1 deletion apps/agric-hub-tests-admin/src/user/EnumRoles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum EnumRoles {
Buyer = "buyer",
User = "user",
Admin = "admin",
Seller = "seller",
}
4 changes: 2 additions & 2 deletions apps/agric-hub-tests-admin/src/user/roles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const ROLES = [
{
name: "buyer",
displayName: "buyer",
name: "user",
displayName: "User",
},
{
name: "admin",
Expand Down
Loading

0 comments on commit a211d77

Please sign in to comment.