2024-09-30 23:05:00 -04:00
|
|
|
const db = require('../config/db.js')
|
|
|
|
|
const { ObjectId } = require('mongodb');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AuthUserAssociation {
|
|
|
|
|
constructor(authProviderId, authId, userId) {
|
|
|
|
|
this._id = new ObjectId();
|
|
|
|
|
this.authProvider_id = authProviderId;
|
|
|
|
|
this.auth_id = authId;
|
|
|
|
|
this.user_id = userId;
|
2024-10-01 00:14:55 -04:00
|
|
|
this.connected = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async find_user_association(authId){
|
|
|
|
|
await db.connect()
|
|
|
|
|
const conn = db.getConnection();
|
|
|
|
|
|
|
|
|
|
const collection = conn.collection('authUserAssociation');
|
|
|
|
|
|
|
|
|
|
const userAssociation = await collection.findOne({ authId: authId });
|
|
|
|
|
return userAssociation
|
2024-09-30 23:05:00 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
module.exports = new AuthUserAssociation;
|