Skip to content
Merged
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
4 changes: 2 additions & 2 deletions sequelize-ts/app/model/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Application } from 'egg';
export default function(app: Application) {
const { STRING, INTEGER, DATE } = app.Sequelize;

const Post = app.model.define('post', {
const Model = app.model.define('post', {
id: {
type: INTEGER,
primaryKey: true,
Expand All @@ -18,7 +18,7 @@ export default function(app: Application) {
updated_at: DATE(6),
});

return class extends Post {
return class Post extends Model {
static associate() {
app.model.Post.belongsTo(app.model.User, { as: 'user', foreignKey: 'user_id' });
}
Expand Down
4 changes: 2 additions & 2 deletions sequelize-ts/app/model/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Application } from 'egg';

export default function(app: Application) {
const { STRING, INTEGER, DATE } = app.Sequelize;
const User = app.model.define('user', {
const Model = app.model.define('user', {
id: {
type: INTEGER,
primaryKey: true,
Expand All @@ -16,7 +16,7 @@ export default function(app: Application) {
updated_at: DATE(6),
});

return class extends User {
return class User extends Model {
static associate() {
app.model.User.hasMany(app.model.Post, { as: 'posts' });
}
Expand Down