mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-24 02:23:08 +02:00
Fix bug
This commit is contained in:
parent
d7635398b2
commit
ad1a86113b
2 changed files with 9 additions and 0 deletions
|
@ -12,6 +12,7 @@ const User = db.get<IUser>('users');
|
||||||
|
|
||||||
User.createIndex('username');
|
User.createIndex('username');
|
||||||
User.createIndex('token');
|
User.createIndex('token');
|
||||||
|
User.createIndex('uri', { sparse: true, unique: true });
|
||||||
|
|
||||||
export default User;
|
export default User;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,14 @@ export default async (value: string | IObject, verifier?: string): Promise<IUser
|
||||||
|
|
||||||
if (id.startsWith(config.url + '/')) {
|
if (id.startsWith(config.url + '/')) {
|
||||||
return await User.findOne({ _id: id.split('/').pop() });
|
return await User.findOne({ _id: id.split('/').pop() });
|
||||||
|
} else {
|
||||||
|
const exist = await User.findOne({
|
||||||
|
uri: id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (exist) {
|
||||||
|
return exist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolver = new Resolver();
|
const resolver = new Resolver();
|
||||||
|
|
Loading…
Reference in a new issue