Skip to content

Commit

Permalink
fixed a bug where plaintexts were ordered by earliest first (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
CluEleSsUK authored Jul 5, 2024
1 parent d444320 commit e22490c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/server/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,39 +109,34 @@ const bootstrap = `
tags JSONB
);
`

const selectCiphertexts = `
SELECT *
FROM ${tableName}
WHERE plaintext IS NULL
ORDER BY decryptable_at ASC
LIMIT $1;
`

const selectPlaintexts = `
SELECT *
FROM ${tableName}
WHERE plaintext IS NOT NULL
ORDER BY decryptable_at ASC
ORDER BY decryptable_at DESC
LIMIT $1;
`

const selectSingle = `
SELECT *
FROM uploads
WHERE id = $1
LIMIT 1;
`

const insertCiphertext = `
INSERT INTO ${tableName} (created_at, decryptable_at, ciphertext, tags) VALUES($1, $2, $3, $4) RETURNING *
`
const updatePlaintext = `
UPDATE ${tableName} SET plaintext = $2 WHERE id = $1
`

const selectTags = `
SELECT *
FROM uploads
WHERE tags @> $1::jsonb;
`
`

0 comments on commit e22490c

Please sign in to comment.