Fix bug with logging in
This commit is contained in:
parent
cc5d482a0f
commit
2e8230ee60
|
@ -6,7 +6,17 @@ import AccessToken from '../../types/AccessToken';
|
|||
import locationManager from '../classes/managers/LocationManager';
|
||||
|
||||
export const createAccessToken = async (accessToken: AccessToken) => {
|
||||
const newAccessToken = await (await AccessTokens()).insertOne(accessToken);
|
||||
const formatted: DBAccessToken = {
|
||||
_id: new ObjectId(),
|
||||
type: accessToken.type,
|
||||
user: accessToken.user?.id ?? new ObjectId(0),
|
||||
entropy: accessToken.entropy,
|
||||
createdAt: accessToken.createdAt,
|
||||
expiresAt: accessToken.expiresAt ?? new Date(accessToken.createdAt.getTime() + 86400000),
|
||||
createdFrom: accessToken.createdFrom
|
||||
}
|
||||
|
||||
const newAccessToken = await (await AccessTokens()).insertOne(formatted);
|
||||
return newAccessToken;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue