Skip to content

Commit

Permalink
Merge remote-tracking branch 'm8a-io/typegoose-support' into typegoos…
Browse files Browse the repository at this point in the history
…e-support

# Conflicts:
#	examples/package.json
#	package-lock.json
#	packages/query-graphql/package.json
#	packages/query-mongoose/__tests__/services/mongoose-query.service.spec.ts
#	packages/query-mongoose/package.json
#	packages/query-typeorm/package.json
  • Loading branch information
doug-martin committed Mar 11, 2021
2 parents d287956 + 223b215 commit bde890b
Show file tree
Hide file tree
Showing 19 changed files with 24,670 additions and 26,394 deletions.
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@nestjs/platform-express": "7.6.13",
"@nestjs/sequelize": "0.2.0",
"@nestjs/typeorm": "7.1.5",
"@typegoose/typegoose": "^7.4.1",
"@typegoose/typegoose": "8.0.0-beta.2",
"apollo-server-express": "2.21.1",
"apollo-server-plugin-base": "0.10.4",
"class-validator": "0.13.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/typegoose/e2e/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const documents = ['TodoItemEntity', 'SubTaskEntity', 'TagEntity'];

export const truncate = async (connection: Connection): Promise<void> =>
asyncLoop(documents, (document) => {
return connection.model(document).remove({}).exec();
return connection.model(document).deleteMany({}).exec();
});

export const refresh = async (connection: Connection): Promise<void> => {
Expand Down
1 change: 1 addition & 0 deletions examples/typegoose/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SubTaskModule } from './sub-task/sub-task.module';
import { mongooseConfig } from '../../helpers';

const { uri, ...options } = mongooseConfig('typegoose', {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
Expand Down
8 changes: 7 additions & 1 deletion examples/typegoose/src/sub-task/sub-task.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Base } from '@typegoose/typegoose/lib/defaultClasses';
import { Prop, modelOptions, Ref } from '@typegoose/typegoose';
import { TodoItemEntity } from '../todo-item/todo-item.entity';
import { Types } from 'mongoose';

@modelOptions({
schemaOptions: {
Expand All @@ -9,7 +10,12 @@ import { TodoItemEntity } from '../todo-item/todo-item.entity';
toObject: { virtuals: true },
},
})
export class SubTaskEntity extends Base {
export class SubTaskEntity implements Base {

_id!: Types.ObjectId

id!: string;

@Prop({ required: true })
title!: string;

Expand Down
12 changes: 7 additions & 5 deletions examples/typegoose/src/tag/tag.entity.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Base } from '@typegoose/typegoose/lib/defaultClasses';
import { Prop, modelOptions, Ref } from '@typegoose/typegoose';
import { TodoItemEntity } from '../todo-item/todo-item.entity';
import { Types } from 'mongoose';

@modelOptions({
schemaOptions: {
Expand All @@ -9,7 +10,12 @@ import { TodoItemEntity } from '../todo-item/todo-item.entity';
toObject: { virtuals: true },
},
})
export class TagEntity extends Base {
export class TagEntity implements Base {

_id!: Types.ObjectId

id!: string;

@Prop({ required: true })
name!: string;

Expand All @@ -32,8 +38,4 @@ export class TagEntity extends Base {
})
todoItems?: Ref<TodoItemEntity>[];

public get id(): string {
// eslint-disable-next-line no-underscore-dangle
return this._id.toHexString();
}
}
12 changes: 7 additions & 5 deletions examples/typegoose/src/todo-item/todo-item.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Base } from '@typegoose/typegoose/lib/defaultClasses';
import { Prop, modelOptions, Ref } from '@typegoose/typegoose';
import { SubTaskEntity } from '../sub-task/sub-task.entity';
import { TagEntity } from '../tag/tag.entity';
import { Types } from 'mongoose';

@modelOptions({
schemaOptions: {
Expand All @@ -10,7 +11,12 @@ import { TagEntity } from '../tag/tag.entity';
toObject: { virtuals: true },
},
})
export class TodoItemEntity extends Base {
export class TodoItemEntity implements Base {

_id!: Types.ObjectId

id!: string;

@Prop({ required: true })
title!: string;

Expand Down Expand Up @@ -45,8 +51,4 @@ export class TodoItemEntity extends Base {
})
subTasks?: Ref<SubTaskEntity>[];

public get id(): string {
// eslint-disable-next-line no-underscore-dangle
return this._id.toHexString();
}
}
Loading

0 comments on commit bde890b

Please sign in to comment.