Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplication build 4i8mfwj6 #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions admin-ui/src/api/user/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type User = {
comments: string | null;
createdAt: Date;
firstName: string | null;
id: string;
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/api/user/UserCreateInput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type UserCreateInput = {
comments?: string | null;
firstName?: string | null;
lastName?: string | null;
password: string;
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/api/user/UserOrderByInput.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { SortOrder } from "../../util/SortOrder";

export type UserOrderByInput = {
comments?: SortOrder;
createdAt?: SortOrder;
firstName?: SortOrder;
id?: SortOrder;
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/api/user/UserUpdateInput.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type UserUpdateInput = {
comments?: string | null;
firstName?: string | null;
lastName?: string | null;
password?: string;
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/api/user/UserWhereInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { StringNullableFilter } from "../../util/StringNullableFilter";
import { StringFilter } from "../../util/StringFilter";

export type UserWhereInput = {
comments?: StringNullableFilter;
firstName?: StringNullableFilter;
id?: StringFilter;
lastName?: StringNullableFilter;
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/user/UserCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const UserCreate = (props: CreateProps): React.ReactElement => {
return (
<Create {...props}>
<SimpleForm>
<TextInput label="Comments" multiline source="comments" />
<TextInput label="First Name" source="firstName" />
<TextInput label="Last Name" source="lastName" />
<PasswordInput label="Password" source="password" />
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/user/UserEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const UserEdit = (props: EditProps): React.ReactElement => {
return (
<Edit {...props}>
<SimpleForm>
<TextInput label="Comments" multiline source="comments" />
<TextInput label="First Name" source="firstName" />
<TextInput label="Last Name" source="lastName" />
<PasswordInput label="Password" source="password" />
Expand Down
3 changes: 2 additions & 1 deletion admin-ui/src/user/UserList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { List, Datagrid, ListProps, DateField, TextField } from "react-admin";
import { List, Datagrid, ListProps, TextField, DateField } from "react-admin";
import Pagination from "../Components/Pagination";

export const UserList = (props: ListProps): React.ReactElement => {
Expand All @@ -12,6 +12,7 @@ export const UserList = (props: ListProps): React.ReactElement => {
pagination={<Pagination />}
>
<Datagrid rowClick="show">
<TextField label="Comments" source="comments" />
<DateField source="createdAt" label="Created At" />
<TextField label="First Name" source="firstName" />
<TextField label="ID" source="id" />
Expand Down
3 changes: 2 additions & 1 deletion admin-ui/src/user/UserShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import {
Show,
SimpleShowLayout,
ShowProps,
DateField,
TextField,
DateField,
} from "react-admin";

export const UserShow = (props: ShowProps): React.ReactElement => {
return (
<Show {...props}>
<SimpleShowLayout>
<TextField label="Comments" source="comments" />
<DateField source="createdAt" label="Created At" />
<TextField label="First Name" source="firstName" />
<TextField label="ID" source="id" />
Expand Down
2 changes: 1 addition & 1 deletion ampconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"appInfo": {
"name": "SaaS",
"description": "Sample application for e-commerce",
"version": "517uoyce",
"version": "su9aoqz1",
"id": "cl22o6zy9149638301s6se2017ma",
"url": "https://app.amplication.com/cl22o6zy9149638301s6se2017ma",
"settings": {
Expand Down
1 change: 1 addition & 0 deletions server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ generator client {
}

model User {
comments String?
createdAt DateTime @default(now())
firstName String?
id String @id @default(cuid())
Expand Down
2 changes: 1 addition & 1 deletion server/src/swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const swaggerDocumentOptions = new DocumentBuilder()
.setDescription(
'Sample application for e-commerce\n\n## Congratulations! Your application is ready.\n \nPlease note that all endpoints are secured with JWT Bearer authentication.\nBy default, your app comes with one user with the username "admin" and password "admin".\nLearn more in [our docs](https://docs.amplication.com)'
)
.setVersion("517uoyce")
.setVersion("su9aoqz1")
.addBearerAuth()
.build();

Expand Down
13 changes: 12 additions & 1 deletion server/src/user/base/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,21 @@ https://docs.amplication.com/docs/how-to/custom-code
*/
import { ObjectType, Field } from "@nestjs/graphql";
import { ApiProperty } from "@nestjs/swagger";
import { IsDate, IsString, IsOptional } from "class-validator";
import { IsString, IsOptional, IsDate } from "class-validator";
import { Type } from "class-transformer";
@ObjectType()
class User {
@ApiProperty({
required: false,
type: String,
})
@IsString()
@IsOptional()
@Field(() => String, {
nullable: true,
})
comments!: string | null;

@ApiProperty({
required: true,
})
Expand Down
11 changes: 11 additions & 0 deletions server/src/user/base/UserCreateInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ import { ApiProperty } from "@nestjs/swagger";
import { IsString, IsOptional } from "class-validator";
@InputType()
class UserCreateInput {
@ApiProperty({
required: false,
type: String,
})
@IsString()
@IsOptional()
@Field(() => String, {
nullable: true,
})
comments?: string | null;

@ApiProperty({
required: false,
type: String,
Expand Down
9 changes: 9 additions & 0 deletions server/src/user/base/UserOrderByInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ import { SortOrder } from "../../util/SortOrder";
description: undefined,
})
class UserOrderByInput {
@ApiProperty({
required: false,
enum: ["asc", "desc"],
})
@Field(() => SortOrder, {
nullable: true,
})
comments?: SortOrder;

@ApiProperty({
required: false,
enum: ["asc", "desc"],
Expand Down
11 changes: 11 additions & 0 deletions server/src/user/base/UserUpdateInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ import { ApiProperty } from "@nestjs/swagger";
import { IsString, IsOptional } from "class-validator";
@InputType()
class UserUpdateInput {
@ApiProperty({
required: false,
type: String,
})
@IsString()
@IsOptional()
@Field(() => String, {
nullable: true,
})
comments?: string | null;

@ApiProperty({
required: false,
type: String,
Expand Down
11 changes: 11 additions & 0 deletions server/src/user/base/UserWhereInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ import { IsOptional } from "class-validator";
import { StringFilter } from "../../util/StringFilter";
@InputType()
class UserWhereInput {
@ApiProperty({
required: false,
type: StringNullableFilter,
})
@Type(() => StringNullableFilter)
@IsOptional()
@Field(() => StringNullableFilter, {
nullable: true,
})
comments?: StringNullableFilter;

@ApiProperty({
required: false,
type: StringNullableFilter,
Expand Down
4 changes: 4 additions & 0 deletions server/src/user/base/user.controller.base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { UserService } from "../user.service";
const nonExistingId = "nonExistingId";
const existingId = "existingId";
const CREATE_INPUT = {
comments: "exampleComments",
createdAt: new Date(),
firstName: "exampleFirstName",
id: "exampleId",
Expand All @@ -21,6 +22,7 @@ const CREATE_INPUT = {
username: "exampleUsername",
};
const CREATE_RESULT = {
comments: "exampleComments",
createdAt: new Date(),
firstName: "exampleFirstName",
id: "exampleId",
Expand All @@ -32,6 +34,7 @@ const CREATE_RESULT = {
};
const FIND_MANY_RESULT = [
{
comments: "exampleComments",
createdAt: new Date(),
firstName: "exampleFirstName",
id: "exampleId",
Expand All @@ -43,6 +46,7 @@ const FIND_MANY_RESULT = [
},
];
const FIND_ONE_RESULT = {
comments: "exampleComments",
createdAt: new Date(),
firstName: "exampleFirstName",
id: "exampleId",
Expand Down
5 changes: 5 additions & 0 deletions server/src/user/base/user.controller.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class UserControllerBase {
return await this.service.create({
data: data,
select: {
comments: true,
createdAt: true,
firstName: true,
id: true,
Expand Down Expand Up @@ -112,6 +113,7 @@ export class UserControllerBase {
const results = await this.service.findMany({
...args,
select: {
comments: true,
createdAt: true,
firstName: true,
id: true,
Expand Down Expand Up @@ -151,6 +153,7 @@ export class UserControllerBase {
const result = await this.service.findOne({
where: params,
select: {
comments: true,
createdAt: true,
firstName: true,
id: true,
Expand Down Expand Up @@ -211,6 +214,7 @@ export class UserControllerBase {
where: params,
data: data,
select: {
comments: true,
createdAt: true,
firstName: true,
id: true,
Expand Down Expand Up @@ -251,6 +255,7 @@ export class UserControllerBase {
return await this.service.delete({
where: params,
select: {
comments: true,
createdAt: true,
firstName: true,
id: true,
Expand Down