Skip to content

Commit 040dbad

Browse files
committed
chore: fix errors after merge with master
1 parent 3c2a294 commit 040dbad

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

src/resolvers/__tests__/createOne-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('createOne() ->', () => {
9696
it('should return payload.errors', async () => {
9797
const result = await createOne(UserModel, UserTC).resolve({
9898
args: {
99-
record: { valid: 'AlwaysFails' },
99+
record: { valid: 'AlwaysFails', contacts: { email: 'mail' } },
100100
},
101101
});
102102
expect(result.errors).toEqual([
@@ -108,7 +108,7 @@ describe('createOne() ->', () => {
108108
it('should return empty payload.errors', async () => {
109109
const result = await createOne(UserModel, UserTC).resolve({
110110
args: {
111-
record: { n: 'foo' },
111+
record: { n: 'foo', contacts: { email: 'mail' } },
112112
},
113113
});
114114
expect(result.errors).toEqual(null);

src/resolvers/createOne.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { Model, Document } from 'mongoose';
33
import { getOrCreateErrorPayload } from '../utils/getOrCreateErrorPayload';
44
import { recordHelperArgs } from './helpers';
55
import type { ExtendedResolveParams, GenResolverOpts } from './index';
6-
import { MongoInstance } from 'mongodb-memory-server';
76

87
export default function createOne<TSource = Document, TContext = any>(
98
model: Model<any>,
@@ -91,7 +90,7 @@ export default function createOne<TSource = Document, TContext = any>(
9190
Object.keys(validationErrors.errors).forEach((key) => {
9291
errors.push({
9392
path: key,
94-
messages: [validationErrors.errors[key].properties.message],
93+
messages: [validationErrors.errors[key].message],
9594
});
9695
});
9796
return {

src/resolvers/updateById.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ export default function updateById<TSource = Document, TContext = any>(
100100
doc.set(recordData);
101101

102102
const validationErrors = doc.validateSync();
103-
let errors: {
104-
path: string,
105-
messages: string[]
103+
let errors: {
104+
path: string;
105+
messages: string[];
106106
}[];
107107
if (validationErrors && validationErrors.errors) {
108108
errors = [];

src/resolvers/updateOne.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default function updateOne<TSource = Document, TContext = any>(
9797
doc.set(recordData);
9898

9999
const validationErrors = doc.validateSync();
100-
let errors = null;
100+
let errors: any[];
101101
if (validationErrors && validationErrors.errors) {
102102
errors = [];
103103
Object.keys(validationErrors.errors).forEach((key) => {

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,12 +3185,12 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6
31853185
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
31863186
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
31873187

3188-
3188+
graphql-compose-connection@^7.0.0:
31893189
version "7.0.1"
31903190
resolved "https://registry.yarnpkg.com/graphql-compose-connection/-/graphql-compose-connection-7.0.1.tgz#fd7be1e4dfa0b42e8aa22335bef4d9679d87a6fb"
31913191
integrity sha512-RYk1MkH5KisSWJCjk7AClI1y8qvkTYvEC5QnZdgduku0uqiEkwDSXz4lgGVfua6v/y/h/SHtxnna/nu/ZocyTg==
31923192

3193-
3193+
graphql-compose-pagination@^7.0.0:
31943194
version "7.0.0"
31953195
resolved "https://registry.yarnpkg.com/graphql-compose-pagination/-/graphql-compose-pagination-7.0.0.tgz#81edf2327416d10f237a3f1ff67990899a37b017"
31963196
integrity sha512-Rak7Dmkb5U4Kio+FgWSucVFho2xxRyCI+kNcZWhxJRVfZusw+VuhjkvxPUiKTiFEb+DtTrXUeetWT24plcC0fg==

0 commit comments

Comments
 (0)