Implement planned features

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 00:38:16 +00:00
parent ecca11a475
commit 061c06be29
10 changed files with 771 additions and 123 deletions

View File

@@ -35,6 +35,18 @@ export interface DependencyConflict {
}>;
}
export interface ConflictCheckResult {
hasConflict: boolean;
clientVersion: {
last_modified_at: string;
};
serverVersion?: {
last_modified_at: string;
last_modified_by: string;
modified_by_profile?: any;
} | null;
}
/**
* Fetch all items for a submission with their dependencies
*/
@@ -1369,25 +1381,6 @@ export async function fetchEditHistory(itemId: string) {
}
}
/**
* Conflict detection interfaces and functions
*/
export interface ConflictCheckResult {
hasConflict: boolean;
serverVersion?: {
last_modified_at: string;
last_modified_by: string;
modified_by_profile?: {
username: string;
display_name: string;
avatar_url: string;
};
};
clientVersion?: {
last_modified_at: string;
};
}
/**
* Check if a submission has been modified since the client last loaded it
* Used for optimistic locking to prevent concurrent edit conflicts
@@ -1425,14 +1418,14 @@ export async function checkSubmissionConflict(
return {
hasConflict: serverTimestamp > clientTimestamp,
clientVersion: {
last_modified_at: clientLastModified,
},
serverVersion: {
last_modified_at: data.last_modified_at,
last_modified_by: data.last_modified_by,
modified_by_profile: data.profiles as any,
},
clientVersion: {
last_modified_at: clientLastModified,
},
};
} catch (error: unknown) {
logger.error('Error checking submission conflict', {