mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-18 23:58:29 +00:00
feat: add explicit invalidation timestamp for statement invalidation
This commit is contained in:
parent
e37e9d7858
commit
dec82742fa
@ -294,8 +294,10 @@ export async function getTripleForStatement({
|
|||||||
|
|
||||||
export async function invalidateStatement({
|
export async function invalidateStatement({
|
||||||
statementId,
|
statementId,
|
||||||
|
invalidAt,
|
||||||
}: {
|
}: {
|
||||||
statementId: string;
|
statementId: string;
|
||||||
|
invalidAt: string;
|
||||||
}) {
|
}) {
|
||||||
const query = `
|
const query = `
|
||||||
MATCH (statement:Statement {uuid: $statementId})
|
MATCH (statement:Statement {uuid: $statementId})
|
||||||
@ -303,7 +305,7 @@ export async function invalidateStatement({
|
|||||||
RETURN statement
|
RETURN statement
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = await runQuery(query, { statementId, invalidAt: new Date() });
|
const result = await runQuery(query, { statementId, invalidAt });
|
||||||
|
|
||||||
if (!result || result.length === 0) {
|
if (!result || result.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -317,8 +319,10 @@ export async function invalidateStatements({
|
|||||||
}: {
|
}: {
|
||||||
statementIds: string[];
|
statementIds: string[];
|
||||||
}) {
|
}) {
|
||||||
|
const invalidAt = new Date().toISOString();
|
||||||
return statementIds.map(
|
return statementIds.map(
|
||||||
async (statementId) => await invalidateStatement({ statementId }),
|
async (statementId) =>
|
||||||
|
await invalidateStatement({ statementId, invalidAt }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user