mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 18:51:11 -05:00
Implement planned features
This commit is contained in:
@@ -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', {
|
||||
|
||||
Reference in New Issue
Block a user