Skip to content

Commit

Permalink
Merge pull request #13 from panter/f/test-create-update
Browse files Browse the repository at this point in the history
create and update test for buildVariables
  • Loading branch information
macrozone authored May 6, 2020
2 parents f230eb4 + 75afce8 commit 57c7048
Show file tree
Hide file tree
Showing 13 changed files with 707 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib
lib-es
node_modules
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"nexus-prisma": "^0.12.0",
"path": "^0.12.7",
"pluralize": "~7.0.0",
"prettier": "^2.0.5",
"react": "~16.12.0",
"react-admin": "^3.4.3",
"react-dom": "~16.13.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/src/addCrudResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ export default (resourceName: string) => {
t.int(queryCountName, {
args: {
where: arg({
type: typeName + "WhereInput",
type: `${typeName}WhereInput`,
required: false,
}),
orderBy: arg({
type: typeName + "OrderByInput",
type: `${typeName}OrderByInput`,
required: false,
}),
skip: intArg({
required: false,
}),
after: arg({
type: typeName + "WhereUniqueInput",
type: `${typeName}WhereUniqueInput`,
required: false,
}),
before: arg({
type: typeName + "WhereUniqueInput",
type: `${typeName}WhereUniqueInput`,
required: false,
}),
first: intArg({
Expand Down
38 changes: 32 additions & 6 deletions packages/dataprovider/generated/nexus-prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,31 +249,39 @@ type GetNexusPrisma<
// Generated
interface ModelTypes {
UserRole: prisma.UserRole
UserSocialMedia: prisma.UserSocialMedia
User: prisma.User
}

interface NexusPrismaInputs {
Query: {
userRoles: {
filtering: 'id' | 'users' | 'AND' | 'OR' | 'NOT'
ordering: 'id'
filtering: 'id' | 'name' | 'users' | 'AND' | 'OR' | 'NOT'
ordering: 'id' | 'name'
}
userSocialMedias: {
filtering: 'id' | 'instagram' | 'twitter' | 'userId' | 'AND' | 'OR' | 'NOT' | 'user'
ordering: 'id' | 'instagram' | 'twitter' | 'userId'
}
users: {
filtering: 'id' | 'email' | 'roles' | 'firstName' | 'lastName' | 'gender' | 'yearOfBirth' | 'wantsNewsletter' | 'AND' | 'OR' | 'NOT'
filtering: 'id' | 'email' | 'roles' | 'firstName' | 'lastName' | 'gender' | 'yearOfBirth' | 'wantsNewsletter' | 'AND' | 'OR' | 'NOT' | 'userSocialMedia'
ordering: 'id' | 'email' | 'firstName' | 'lastName' | 'gender' | 'yearOfBirth' | 'wantsNewsletter'
}

},
UserRole: {
users: {
filtering: 'id' | 'email' | 'roles' | 'firstName' | 'lastName' | 'gender' | 'yearOfBirth' | 'wantsNewsletter' | 'AND' | 'OR' | 'NOT'
filtering: 'id' | 'email' | 'roles' | 'firstName' | 'lastName' | 'gender' | 'yearOfBirth' | 'wantsNewsletter' | 'AND' | 'OR' | 'NOT' | 'userSocialMedia'
ordering: 'id' | 'email' | 'firstName' | 'lastName' | 'gender' | 'yearOfBirth' | 'wantsNewsletter'
}

}, UserSocialMedia: {


}, User: {
roles: {
filtering: 'id' | 'users' | 'AND' | 'OR' | 'NOT'
ordering: 'id'
filtering: 'id' | 'name' | 'users' | 'AND' | 'OR' | 'NOT'
ordering: 'id' | 'name'
}

}
Expand All @@ -283,6 +291,8 @@ interface NexusPrismaTypes {
Query: {
userRole: 'UserRole'
userRoles: 'UserRole'
userSocialMedia: 'UserSocialMedia'
userSocialMedias: 'UserSocialMedia'
user: 'User'
users: 'User'

Expand All @@ -294,6 +304,12 @@ interface NexusPrismaTypes {
deleteOneUserRole: 'UserRole'
deleteManyUserRole: 'BatchPayload'
upsertOneUserRole: 'UserRole'
createOneUserSocialMedia: 'UserSocialMedia'
updateOneUserSocialMedia: 'UserSocialMedia'
updateManyUserSocialMedia: 'BatchPayload'
deleteOneUserSocialMedia: 'UserSocialMedia'
deleteManyUserSocialMedia: 'BatchPayload'
upsertOneUserSocialMedia: 'UserSocialMedia'
createOneUser: 'User'
updateOneUser: 'User'
updateManyUser: 'BatchPayload'
Expand All @@ -304,8 +320,16 @@ interface NexusPrismaTypes {
},
UserRole: {
id: 'String'
name: 'String'
users: 'User'

}, UserSocialMedia: {
id: 'String'
instagram: 'String'
twitter: 'String'
user: 'User'
userId: 'String'

}, User: {
id: 'String'
email: 'String'
Expand All @@ -315,12 +339,14 @@ interface NexusPrismaTypes {
gender: 'Gender'
yearOfBirth: 'Int'
wantsNewsletter: 'Boolean'
userSocialMedia: 'UserSocialMedia'

}
}

interface NexusPrismaMethods {
UserRole: NexusPrismaFields<'UserRole'>
UserSocialMedia: NexusPrismaFields<'UserSocialMedia'>
User: NexusPrismaFields<'User'>
Query: NexusPrismaFields<'Query'>
Mutation: NexusPrismaFields<'Mutation'>
Expand Down
86 changes: 80 additions & 6 deletions packages/dataprovider/generated/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface NexusGenInputs {
id?: string | null; // String
lastName?: string | null; // String
roles?: NexusGenInputs['UserRoleCreateManyWithoutUsersInput'] | null; // UserRoleCreateManyWithoutUsersInput
userSocialMedia?: NexusGenInputs['UserSocialMediaCreateOneWithoutUserInput'] | null; // UserSocialMediaCreateOneWithoutUserInput
wantsNewsletter: boolean; // Boolean!
yearOfBirth?: number | null; // Int
}
Expand All @@ -92,6 +93,7 @@ export interface NexusGenInputs {
gender?: NexusGenEnums['Gender'] | null; // Gender
id?: string | null; // String
lastName?: string | null; // String
userSocialMedia?: NexusGenInputs['UserSocialMediaCreateOneWithoutUserInput'] | null; // UserSocialMediaCreateOneWithoutUserInput
wantsNewsletter: boolean; // Boolean!
yearOfBirth?: number | null; // Int
}
Expand All @@ -110,15 +112,17 @@ export interface NexusGenInputs {
yearOfBirth?: NexusGenEnums['OrderByArg'] | null; // OrderByArg
}
UserRoleCreateInput: { // input type
id: string; // String!
id?: string | null; // String
name: string; // String!
users?: NexusGenInputs['UserCreateManyWithoutRolesInput'] | null; // UserCreateManyWithoutRolesInput
}
UserRoleCreateManyWithoutUsersInput: { // input type
connect?: NexusGenInputs['UserRoleWhereUniqueInput'][] | null; // [UserRoleWhereUniqueInput!]
create?: NexusGenInputs['UserRoleCreateWithoutUsersInput'][] | null; // [UserRoleCreateWithoutUsersInput!]
}
UserRoleCreateWithoutUsersInput: { // input type
id: string; // String!
id?: string | null; // String
name: string; // String!
}
UserRoleFilter: { // input type
every?: NexusGenInputs['UserRoleWhereInput'] | null; // UserRoleWhereInput
Expand All @@ -127,23 +131,28 @@ export interface NexusGenInputs {
}
UserRoleOrderByInput: { // input type
id?: NexusGenEnums['OrderByArg'] | null; // OrderByArg
name?: NexusGenEnums['OrderByArg'] | null; // OrderByArg
}
UserRoleScalarWhereInput: { // input type
AND?: NexusGenInputs['UserRoleScalarWhereInput'][] | null; // [UserRoleScalarWhereInput!]
id?: NexusGenInputs['StringFilter'] | null; // StringFilter
id?: NexusGenInputs['UUIDFilter'] | null; // UUIDFilter
name?: NexusGenInputs['StringFilter'] | null; // StringFilter
NOT?: NexusGenInputs['UserRoleScalarWhereInput'][] | null; // [UserRoleScalarWhereInput!]
OR?: NexusGenInputs['UserRoleScalarWhereInput'][] | null; // [UserRoleScalarWhereInput!]
users?: NexusGenInputs['UserFilter'] | null; // UserFilter
}
UserRoleUpdateInput: { // input type
id?: string | null; // String
name?: string | null; // String
users?: NexusGenInputs['UserUpdateManyWithoutRolesInput'] | null; // UserUpdateManyWithoutRolesInput
}
UserRoleUpdateManyDataInput: { // input type
id?: string | null; // String
name?: string | null; // String
}
UserRoleUpdateManyMutationInput: { // input type
id?: string | null; // String
name?: string | null; // String
}
UserRoleUpdateManyWithWhereNestedInput: { // input type
data: NexusGenInputs['UserRoleUpdateManyDataInput']; // UserRoleUpdateManyDataInput!
Expand All @@ -166,6 +175,7 @@ export interface NexusGenInputs {
}
UserRoleUpdateWithoutUsersDataInput: { // input type
id?: string | null; // String
name?: string | null; // String
}
UserRoleUpsertWithWhereUniqueWithoutUsersInput: { // input type
create: NexusGenInputs['UserRoleCreateWithoutUsersInput']; // UserRoleCreateWithoutUsersInput!
Expand All @@ -174,7 +184,8 @@ export interface NexusGenInputs {
}
UserRoleWhereInput: { // input type
AND?: NexusGenInputs['UserRoleWhereInput'][] | null; // [UserRoleWhereInput!]
id?: NexusGenInputs['StringFilter'] | null; // StringFilter
id?: NexusGenInputs['UUIDFilter'] | null; // UUIDFilter
name?: NexusGenInputs['StringFilter'] | null; // StringFilter
NOT?: NexusGenInputs['UserRoleWhereInput'][] | null; // [UserRoleWhereInput!]
OR?: NexusGenInputs['UserRoleWhereInput'][] | null; // [UserRoleWhereInput!]
users?: NexusGenInputs['UserFilter'] | null; // UserFilter
Expand All @@ -195,13 +206,53 @@ export interface NexusGenInputs {
wantsNewsletter?: NexusGenInputs['BooleanFilter'] | null; // BooleanFilter
yearOfBirth?: NexusGenInputs['NullableIntFilter'] | null; // NullableIntFilter
}
UserSocialMediaCreateOneWithoutUserInput: { // input type
connect?: NexusGenInputs['UserSocialMediaWhereUniqueInput'] | null; // UserSocialMediaWhereUniqueInput
create?: NexusGenInputs['UserSocialMediaCreateWithoutUserInput'] | null; // UserSocialMediaCreateWithoutUserInput
}
UserSocialMediaCreateWithoutUserInput: { // input type
id?: string | null; // String
instagram: string; // String!
twitter: string; // String!
}
UserSocialMediaUpdateOneWithoutUserInput: { // input type
connect?: NexusGenInputs['UserSocialMediaWhereUniqueInput'] | null; // UserSocialMediaWhereUniqueInput
create?: NexusGenInputs['UserSocialMediaCreateWithoutUserInput'] | null; // UserSocialMediaCreateWithoutUserInput
delete?: boolean | null; // Boolean
disconnect?: boolean | null; // Boolean
update?: NexusGenInputs['UserSocialMediaUpdateWithoutUserDataInput'] | null; // UserSocialMediaUpdateWithoutUserDataInput
upsert?: NexusGenInputs['UserSocialMediaUpsertWithoutUserInput'] | null; // UserSocialMediaUpsertWithoutUserInput
}
UserSocialMediaUpdateWithoutUserDataInput: { // input type
id?: string | null; // String
instagram?: string | null; // String
twitter?: string | null; // String
}
UserSocialMediaUpsertWithoutUserInput: { // input type
create: NexusGenInputs['UserSocialMediaCreateWithoutUserInput']; // UserSocialMediaCreateWithoutUserInput!
update: NexusGenInputs['UserSocialMediaUpdateWithoutUserDataInput']; // UserSocialMediaUpdateWithoutUserDataInput!
}
UserSocialMediaWhereInput: { // input type
AND?: NexusGenInputs['UserSocialMediaWhereInput'][] | null; // [UserSocialMediaWhereInput!]
id?: NexusGenInputs['UUIDFilter'] | null; // UUIDFilter
instagram?: NexusGenInputs['StringFilter'] | null; // StringFilter
NOT?: NexusGenInputs['UserSocialMediaWhereInput'][] | null; // [UserSocialMediaWhereInput!]
OR?: NexusGenInputs['UserSocialMediaWhereInput'][] | null; // [UserSocialMediaWhereInput!]
twitter?: NexusGenInputs['StringFilter'] | null; // StringFilter
user?: NexusGenInputs['UserWhereInput'] | null; // UserWhereInput
userId?: NexusGenInputs['StringFilter'] | null; // StringFilter
}
UserSocialMediaWhereUniqueInput: { // input type
id?: string | null; // String
}
UserUpdateInput: { // input type
email?: string | null; // String
firstName?: string | null; // String
gender?: NexusGenEnums['Gender'] | null; // Gender
id?: string | null; // String
lastName?: string | null; // String
roles?: NexusGenInputs['UserRoleUpdateManyWithoutUsersInput'] | null; // UserRoleUpdateManyWithoutUsersInput
userSocialMedia?: NexusGenInputs['UserSocialMediaUpdateOneWithoutUserInput'] | null; // UserSocialMediaUpdateOneWithoutUserInput
wantsNewsletter?: boolean | null; // Boolean
yearOfBirth?: number | null; // Int
}
Expand Down Expand Up @@ -248,6 +299,7 @@ export interface NexusGenInputs {
gender?: NexusGenEnums['Gender'] | null; // Gender
id?: string | null; // String
lastName?: string | null; // String
userSocialMedia?: NexusGenInputs['UserSocialMediaUpdateOneWithoutUserInput'] | null; // UserSocialMediaUpdateOneWithoutUserInput
wantsNewsletter?: boolean | null; // Boolean
yearOfBirth?: number | null; // Int
}
Expand All @@ -266,6 +318,7 @@ export interface NexusGenInputs {
NOT?: NexusGenInputs['UserWhereInput'][] | null; // [UserWhereInput!]
OR?: NexusGenInputs['UserWhereInput'][] | null; // [UserWhereInput!]
roles?: NexusGenInputs['UserRoleFilter'] | null; // UserRoleFilter
userSocialMedia?: NexusGenInputs['UserSocialMediaWhereInput'] | null; // UserSocialMediaWhereInput
wantsNewsletter?: NexusGenInputs['BooleanFilter'] | null; // BooleanFilter
yearOfBirth?: NexusGenInputs['NullableIntFilter'] | null; // NullableIntFilter
}
Expand Down Expand Up @@ -298,6 +351,12 @@ export interface NexusGenRootTypes {
}
UserRole: { // root type
id: string; // String!
name: string; // String!
}
UserSocialMedia: { // root type
id: string; // String!
instagram: string; // String!
twitter: string; // String!
}
String: string;
Int: number;
Expand Down Expand Up @@ -335,6 +394,13 @@ export interface NexusGenAllTypes extends NexusGenRootTypes {
UserRoleWhereInput: NexusGenInputs['UserRoleWhereInput'];
UserRoleWhereUniqueInput: NexusGenInputs['UserRoleWhereUniqueInput'];
UserScalarWhereInput: NexusGenInputs['UserScalarWhereInput'];
UserSocialMediaCreateOneWithoutUserInput: NexusGenInputs['UserSocialMediaCreateOneWithoutUserInput'];
UserSocialMediaCreateWithoutUserInput: NexusGenInputs['UserSocialMediaCreateWithoutUserInput'];
UserSocialMediaUpdateOneWithoutUserInput: NexusGenInputs['UserSocialMediaUpdateOneWithoutUserInput'];
UserSocialMediaUpdateWithoutUserDataInput: NexusGenInputs['UserSocialMediaUpdateWithoutUserDataInput'];
UserSocialMediaUpsertWithoutUserInput: NexusGenInputs['UserSocialMediaUpsertWithoutUserInput'];
UserSocialMediaWhereInput: NexusGenInputs['UserSocialMediaWhereInput'];
UserSocialMediaWhereUniqueInput: NexusGenInputs['UserSocialMediaWhereUniqueInput'];
UserUpdateInput: NexusGenInputs['UserUpdateInput'];
UserUpdateManyDataInput: NexusGenInputs['UserUpdateManyDataInput'];
UserUpdateManyMutationInput: NexusGenInputs['UserUpdateManyMutationInput'];
Expand Down Expand Up @@ -383,11 +449,19 @@ export interface NexusGenFieldTypes {
lastName: string | null; // String
logs: string[]; // [String!]!
roles: NexusGenRootTypes['UserRole'][]; // [UserRole!]!
userSocialMedia: NexusGenRootTypes['UserSocialMedia'] | null; // UserSocialMedia
wantsNewsletter: boolean; // Boolean!
yearOfBirth: number | null; // Int
}
UserRole: { // field return type
id: string; // String!
name: string; // String!
}
UserSocialMedia: { // field return type
id: string; // String!
instagram: string; // String!
twitter: string; // String!
user: NexusGenRootTypes['User']; // User!
}
}

Expand Down Expand Up @@ -503,9 +577,9 @@ export interface NexusGenAbstractResolveReturnTypes {

export interface NexusGenInheritedFields {}

export type NexusGenObjectNames = "BatchPayload" | "Mutation" | "Query" | "User" | "UserRole";
export type NexusGenObjectNames = "BatchPayload" | "Mutation" | "Query" | "User" | "UserRole" | "UserSocialMedia";

export type NexusGenInputNames = "BooleanFilter" | "NullableIntFilter" | "NullableStringFilter" | "StringFilter" | "UUIDFilter" | "UserCreateInput" | "UserCreateManyWithoutRolesInput" | "UserCreateWithoutRolesInput" | "UserFilter" | "UserOrderByInput" | "UserRoleCreateInput" | "UserRoleCreateManyWithoutUsersInput" | "UserRoleCreateWithoutUsersInput" | "UserRoleFilter" | "UserRoleOrderByInput" | "UserRoleScalarWhereInput" | "UserRoleUpdateInput" | "UserRoleUpdateManyDataInput" | "UserRoleUpdateManyMutationInput" | "UserRoleUpdateManyWithWhereNestedInput" | "UserRoleUpdateManyWithoutUsersInput" | "UserRoleUpdateWithWhereUniqueWithoutUsersInput" | "UserRoleUpdateWithoutUsersDataInput" | "UserRoleUpsertWithWhereUniqueWithoutUsersInput" | "UserRoleWhereInput" | "UserRoleWhereUniqueInput" | "UserScalarWhereInput" | "UserUpdateInput" | "UserUpdateManyDataInput" | "UserUpdateManyMutationInput" | "UserUpdateManyWithWhereNestedInput" | "UserUpdateManyWithoutRolesInput" | "UserUpdateWithWhereUniqueWithoutRolesInput" | "UserUpdateWithoutRolesDataInput" | "UserUpsertWithWhereUniqueWithoutRolesInput" | "UserWhereInput" | "UserWhereUniqueInput";
export type NexusGenInputNames = "BooleanFilter" | "NullableIntFilter" | "NullableStringFilter" | "StringFilter" | "UUIDFilter" | "UserCreateInput" | "UserCreateManyWithoutRolesInput" | "UserCreateWithoutRolesInput" | "UserFilter" | "UserOrderByInput" | "UserRoleCreateInput" | "UserRoleCreateManyWithoutUsersInput" | "UserRoleCreateWithoutUsersInput" | "UserRoleFilter" | "UserRoleOrderByInput" | "UserRoleScalarWhereInput" | "UserRoleUpdateInput" | "UserRoleUpdateManyDataInput" | "UserRoleUpdateManyMutationInput" | "UserRoleUpdateManyWithWhereNestedInput" | "UserRoleUpdateManyWithoutUsersInput" | "UserRoleUpdateWithWhereUniqueWithoutUsersInput" | "UserRoleUpdateWithoutUsersDataInput" | "UserRoleUpsertWithWhereUniqueWithoutUsersInput" | "UserRoleWhereInput" | "UserRoleWhereUniqueInput" | "UserScalarWhereInput" | "UserSocialMediaCreateOneWithoutUserInput" | "UserSocialMediaCreateWithoutUserInput" | "UserSocialMediaUpdateOneWithoutUserInput" | "UserSocialMediaUpdateWithoutUserDataInput" | "UserSocialMediaUpsertWithoutUserInput" | "UserSocialMediaWhereInput" | "UserSocialMediaWhereUniqueInput" | "UserUpdateInput" | "UserUpdateManyDataInput" | "UserUpdateManyMutationInput" | "UserUpdateManyWithWhereNestedInput" | "UserUpdateManyWithoutRolesInput" | "UserUpdateWithWhereUniqueWithoutRolesInput" | "UserUpdateWithoutRolesDataInput" | "UserUpsertWithWhereUniqueWithoutRolesInput" | "UserWhereInput" | "UserWhereUniqueInput";

export type NexusGenEnumNames = "Gender" | "OrderByArg";

Expand Down
Loading

0 comments on commit 57c7048

Please sign in to comment.