transforming response and getting the right object back for the line
This commit is contained in:
@@ -46,6 +46,20 @@ export class LineService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Get all of the members associated to the given list of lines */
|
||||
static async getLineMembersInLines(lineIds: ObjectId[]) {
|
||||
const query = { lineId: { $in: lineIds } };
|
||||
|
||||
const lineMembersRes = await collections.lineMembers?.find(query).toArray();
|
||||
|
||||
// exists
|
||||
if (lineMembersRes?.length) {
|
||||
return lineMembersRes as LineMember[];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static async createLine(line: Line, lineMembers: LineMember[]) {
|
||||
const session = client.startSession();
|
||||
try {
|
||||
|
||||
@@ -19,6 +19,19 @@ export class UserService {
|
||||
return null;
|
||||
}
|
||||
|
||||
static async getUsersByIds(userIds: ObjectId[]) {
|
||||
const query = { _id: { $in: userIds } };
|
||||
|
||||
const res = await collections.users?.find(query).toArray();
|
||||
|
||||
// exists
|
||||
if (res?.length) {
|
||||
return res as User[];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
static async getUserByGoogleId(googleUserId: string) {
|
||||
const query = { googleId: googleUserId };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user