mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
* upgrade typeorm to 3.0 * use new datasource object in typeorm 3 * fix tests * fix tests * migrate before creating connection * fail the test if migration failed
19 lines
463 B
TypeScript
19 lines
463 B
TypeScript
import { Link } from '../entity/link'
|
|
import { setClaims } from '../entity/utils'
|
|
import { AppDataSource } from '../server'
|
|
|
|
export const setLinkArchived = async (
|
|
userId: string,
|
|
linkId: string,
|
|
archived: boolean
|
|
): Promise<void> => {
|
|
await AppDataSource.transaction(async (t) => {
|
|
await setClaims(t, userId)
|
|
await t.getRepository(Link).update(
|
|
{
|
|
id: linkId,
|
|
},
|
|
{ archivedAt: archived ? new Date() : null }
|
|
)
|
|
})
|
|
}
|