()
| 4 | const { type } = models.userSession; |
| 5 | |
| 6 | export async function get() { |
| 7 | const result = await db.findOne<UserSession>(type); |
| 8 | |
| 9 | if (!result) { |
| 10 | const user = await db.docCreate<UserSession>(type); |
| 11 | return user; |
| 12 | } |
| 13 | return result; |
| 14 | } |
| 15 | |
| 16 | export async function update(patch: Partial<UserSession>) { |
| 17 | const user = await get(); |