providers
This commit is contained in:
1 parent
7d6bc4b2dc
commit
f7f764fd68
11 files changed
+126
-24
No files matched your search
@@ -2,6 +2,7 @@ import type { Notification } from "@/types/index.js";
|
||||
export interface INotificationsRepository {
|
||||
// create
|
||||
// fetch
|
||||
findNotificationsByIds(ids: string[]): Promise<Notification[]>;
|
||||
// update
|
||||
// delete
|
||||
}
|
||||
@@ -35,6 +35,12 @@ class MongoNotificationsRepository implements INotificationsRepository {
|
||||
updatedAt: toDateString(doc.updatedAt),
|
||||
};
|
||||
};
|
||||
|
||||
findNotificationsByIds = async (ids: string[]) => {
|
||||
const mongoIds = ids.map((id) => new mongoose.Types.ObjectId(id));
|
||||
const documents = await NotificationModel.find({ _id: { $in: mongoIds } });
|
||||
return this.mapDocuments(documents);
|
||||
};
|
||||
}
|
||||
|
||||
export default MongoNotificationsRepository;
|
||||
Reference in new issue
Block a user