Reads and writes each user's settings in user_settings. routes/me.ts answers GET and PATCH /api/me/settings with it, and the digests read their readers' choices from the same table.

Functions

f
getSettings(userId: string): UserSettings

Returns the settings of user userId, the defaults if they changed none.

f
updateSettings(
userId: string,
patch: UpdateSettingsRequest
): UserSettings

Applies patch to the settings of user userId and returns them all. The settings it leaves out keep their value.