8000 fix: remove unscoped fn in src/adapters/sequelize.js by vagusX · Pull Request #387 · cyjake/leoric · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: remove unscoped fn in src/adapters/sequelize.js #387

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

Merged
merged 4 commits into from
May 11, 2023
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
2 changes: 1 addition & 1 deletion src/adapters/sequelize.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class SequelizeBone extends AbstractBone {
*/
static scope<T extends typeof SequelizeBone>(this: T, name?: (string | ((...args: any[]) => SequelizeConditions<T>) | SequelizeConditions<T> | Array<SequelizeConditions<T>>), ...args: any[]): T;

static unscoped(): Spell<typeof SequelizeBone>;
static get unscoped(): Spell<typeof SequelizeBone>;

/**
* @deprecated scope is not recommended to use
Expand Down
4 changes: 0 additions & 4 deletions src/adapters/sequelize.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ module.exports = function sequelize(Bone) {
return this.scope();
}

static unscoped() {
return this.scope();
}

/**
* @deprecated scope is not recommended to use
* @static
Expand Down
2 changes: 1 addition & 1 deletion test/types/sequelize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ describe('=> sequelize (TypeScript)', function() {
assert.ok(!!(MyPost as any)._scopes.dk);
assert.deepEqual((MyPost as any)._scopes.dk, (Scopped as any)._scope);

const Scopped1 = Scopped.unscoped();
const Scopped1 = Scopped.unscoped;
assert.ok(!(Scopped1 as any)._scope);

});
Expand Down
6 changes: 3 additions & 3 deletions test/unit/adapters/sequelize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1346,9 +1346,9 @@ describe('Model scope', () => {
);
});

it('unscoped() should work', function() {
it('getter unscoped should work', function() {
assert.equal(
MyPost.scope('MHW').unscoped().where({ title: 'New Post' }).toString(),
MyPost.scope('MHW').unscoped.where({ title: 'New Post' }).toString(),
'SELECT * FROM "articles" WHERE "title" = \'New Post\' AND "gmt_deleted" IS NULL'
);
});
Expand Down Expand Up @@ -1409,7 +1409,7 @@ describe('Model scope', () => {
);

assert.equal(
User.unscoped().where({ nickname: 'OldHunter' }).toString(),
User.unscoped.where({ nickname: 'OldHunter' }).toString(),
'SELECT * FROM "users" WHERE "nickname" = \'OldHunter\''
);

Expand Down
0