✨ feat: add internal endpoint to purge user session
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
import { AppError } from "../../../helpers/error/instances/app";
|
||||
import { prisma } from "../../../utils/databases/prisma/connection";
|
||||
|
||||
export const deleteAllUnusedUserSessionRepository = async () => {
|
||||
try {
|
||||
return await prisma.userSession.deleteMany({
|
||||
where: {
|
||||
isAuthenticated: false,
|
||||
deletedAt: {
|
||||
not: null,
|
||||
},
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
throw new AppError(500, "Failed to delete all unused user sessions", error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user