Convert UUID to class
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// Jason mentions pruning, but I don't quite understand how that will be done yet.
|
||||
// He also has the concept of "extensions" - but I'm not sure this has been fleshed out yet.
|
||||
|
||||
import { generateUUIDV7, getTimestampFromUUID } from '../utils';
|
||||
import { UUIDV7 } from '../utils';
|
||||
import { BaseStore } from '../storage';
|
||||
|
||||
// TODO: Think about different activities
|
||||
@@ -200,7 +200,7 @@ export class Activities {
|
||||
timestamp,
|
||||
};
|
||||
|
||||
const key = generateUUIDV7(timestamp);
|
||||
const key = UUIDV7.fromTimestamp(timestamp).toString();
|
||||
await this.store.set(key, activityWithTimestamp);
|
||||
// Note: We don't need to call processActivity here as the 'set' event will trigger it
|
||||
}
|
||||
@@ -221,8 +221,8 @@ export class Activities {
|
||||
|
||||
// Sort activities by timestamp using UUID v7's embedded timestamp
|
||||
const activitiesSorted = filteredEntries.sort(([keyA], [keyB]) => {
|
||||
const timestampA = getTimestampFromUUID(keyA);
|
||||
const timestampB = getTimestampFromUUID(keyB);
|
||||
const timestampA = UUIDV7.from(keyA).getTimestamp();
|
||||
const timestampB = UUIDV7.from(keyB).getTimestamp();
|
||||
return Number(timestampA - timestampB);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user