fix lint
This commit is contained in:
@@ -15,17 +15,17 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
token: {
|
||||
validator: $.str
|
||||
}
|
||||
validator: $.str,
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchSession: {
|
||||
message: 'No such session.',
|
||||
code: 'NO_SUCH_SESSION',
|
||||
id: '9c72d8de-391a-43c1-9d06-08d29efde8df'
|
||||
id: '9c72d8de-391a-43c1-9d06-08d29efde8df',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -65,12 +65,12 @@ export default define(meta, async (ps, user) => {
|
||||
appId: session.appId,
|
||||
userId: user.id,
|
||||
token: accessToken,
|
||||
hash: hash
|
||||
hash: hash,
|
||||
});
|
||||
}
|
||||
|
||||
// Update session
|
||||
await AuthSessions.update(session.id, {
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
});
|
||||
|
@@ -14,7 +14,7 @@ export const meta = {
|
||||
params: {
|
||||
appSecret: {
|
||||
validator: $.str,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -30,22 +30,22 @@ export const meta = {
|
||||
optional: false as const, nullable: false as const,
|
||||
format: 'url',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchApp: {
|
||||
message: 'No such app.',
|
||||
code: 'NO_SUCH_APP',
|
||||
id: '92f93e63-428e-4f2f-a5a4-39e1407fe998'
|
||||
}
|
||||
}
|
||||
id: '92f93e63-428e-4f2f-a5a4-39e1407fe998',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps) => {
|
||||
// Lookup app
|
||||
const app = await Apps.findOne({
|
||||
secret: ps.appSecret
|
||||
secret: ps.appSecret,
|
||||
});
|
||||
|
||||
if (app == null) {
|
||||
@@ -60,11 +60,11 @@ export default define(meta, async (ps) => {
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
appId: app.id,
|
||||
token: token
|
||||
token: token,
|
||||
});
|
||||
|
||||
return {
|
||||
token: doc.token,
|
||||
url: `${config.authUrl}/${doc.token}`
|
||||
url: `${config.authUrl}/${doc.token}`,
|
||||
};
|
||||
});
|
||||
|
@@ -11,15 +11,15 @@ export const meta = {
|
||||
params: {
|
||||
token: {
|
||||
validator: $.str,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchSession: {
|
||||
message: 'No such session.',
|
||||
code: 'NO_SUCH_SESSION',
|
||||
id: 'bd72c97d-eba7-4adb-a467-f171b8847250'
|
||||
}
|
||||
id: 'bd72c97d-eba7-4adb-a467-f171b8847250',
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -29,25 +29,25 @@ export const meta = {
|
||||
id: {
|
||||
type: 'string' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
format: 'id'
|
||||
format: 'id',
|
||||
},
|
||||
app: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'App'
|
||||
ref: 'App',
|
||||
},
|
||||
token: {
|
||||
type: 'string' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
}
|
||||
}
|
||||
}
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
// Lookup session
|
||||
const session = await AuthSessions.findOne({
|
||||
token: ps.token
|
||||
token: ps.token,
|
||||
});
|
||||
|
||||
if (session == null) {
|
||||
|
@@ -15,7 +15,7 @@ export const meta = {
|
||||
|
||||
token: {
|
||||
validator: $.str,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -32,34 +32,34 @@ export const meta = {
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'User',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchApp: {
|
||||
message: 'No such app.',
|
||||
code: 'NO_SUCH_APP',
|
||||
id: 'fcab192a-2c5a-43b7-8ad8-9b7054d8d40d'
|
||||
id: 'fcab192a-2c5a-43b7-8ad8-9b7054d8d40d',
|
||||
},
|
||||
|
||||
noSuchSession: {
|
||||
message: 'No such session.',
|
||||
code: 'NO_SUCH_SESSION',
|
||||
id: '5b5a1503-8bc8-4bd0-8054-dc189e8cdcb3'
|
||||
id: '5b5a1503-8bc8-4bd0-8054-dc189e8cdcb3',
|
||||
},
|
||||
|
||||
pendingSession: {
|
||||
message: 'This session is not completed yet.',
|
||||
code: 'PENDING_SESSION',
|
||||
id: '8c8a4145-02cc-4cca-8e66-29ba60445a8e'
|
||||
}
|
||||
}
|
||||
id: '8c8a4145-02cc-4cca-8e66-29ba60445a8e',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps) => {
|
||||
// Lookup app
|
||||
const app = await Apps.findOne({
|
||||
secret: ps.appSecret
|
||||
secret: ps.appSecret,
|
||||
});
|
||||
|
||||
if (app == null) {
|
||||
@@ -69,7 +69,7 @@ export default define(meta, async (ps) => {
|
||||
// Fetch token
|
||||
const session = await AuthSessions.findOne({
|
||||
token: ps.token,
|
||||
appId: app.id
|
||||
appId: app.id,
|
||||
});
|
||||
|
||||
if (session == null) {
|
||||
@@ -83,7 +83,7 @@ export default define(meta, async (ps) => {
|
||||
// Lookup access token
|
||||
const accessToken = await AccessTokens.findOneOrFail({
|
||||
appId: app.id,
|
||||
userId: session.userId
|
||||
userId: session.userId,
|
||||
});
|
||||
|
||||
// Delete session
|
||||
@@ -92,7 +92,7 @@ export default define(meta, async (ps) => {
|
||||
return {
|
||||
accessToken: accessToken.token,
|
||||
user: await Users.pack(session.userId, null, {
|
||||
detail: true
|
||||
})
|
||||
detail: true,
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user