mirror of
https://github.com/get-drexa/drive.git
synced 2026-02-02 13:21:17 +00:00
refactor[db]: store time as unix ms
Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -144,7 +144,7 @@ export async function create(
|
||||
)
|
||||
}
|
||||
|
||||
const now = new Date().toISOString()
|
||||
const now = Date.now()
|
||||
return await ctx.db.insert("directories", {
|
||||
name,
|
||||
parentId,
|
||||
@@ -216,7 +216,7 @@ export async function move(
|
||||
ignoredHandles.add(handle)
|
||||
} else {
|
||||
promises.push(
|
||||
ctx.db.patch(handle.id, { parentId: targetDirectory.id }),
|
||||
ctx.db.patch(handle.id, { parentId: targetDirectory.id, updatedAt: Date.now() }),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ export async function moveToTrashRecursive(
|
||||
ctx: AuthenticatedMutationCtx,
|
||||
handle: DirectoryHandle,
|
||||
): Promise<void> {
|
||||
const now = new Date().toISOString()
|
||||
const now = Date.now()
|
||||
|
||||
const filesToDelete: Id<"files">[] = []
|
||||
const directoriesToDelete: Id<"directories">[] = []
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function renameFile(
|
||||
)
|
||||
}
|
||||
|
||||
await ctx.db.patch(itemId, { name: newName })
|
||||
await ctx.db.patch(itemId, { name: newName, updatedAt: Date.now() })
|
||||
}
|
||||
|
||||
export async function move(
|
||||
@@ -90,7 +90,7 @@ export async function move(
|
||||
|
||||
const results = await Promise.allSettled(
|
||||
okFiles.map((handle) =>
|
||||
ctx.db.patch(handle.id, { directoryId: targetDirectoryHandle.id }),
|
||||
ctx.db.patch(handle.id, { directoryId: targetDirectoryHandle.id, updatedAt: Date.now() }),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function userOrThrow(ctx: QueryCtx | MutationCtx) {
|
||||
}
|
||||
|
||||
export async function register(ctx: AuthenticatedMutationCtx) {
|
||||
const now = new Date().toISOString()
|
||||
const now = Date.now()
|
||||
await Promise.all([
|
||||
ctx.db.insert("users", {
|
||||
jwtSubject: ctx.identity.subject,
|
||||
|
||||
Reference in New Issue
Block a user