manifold/web/lib/firebase/views.ts

17 lines
401 B
TypeScript
Raw Normal View History

2022-04-05 03:28:38 +00:00
import { doc, collection, setDoc } from 'firebase/firestore'
import _ from 'lodash'
import { db } from './init'
import { View } from '../../../common/view'
export async function logView(userId: string, contractId: string) {
const ref = doc(collection(db, 'private-users', userId, 'views'))
const view: View = {
contractId,
timestamp: Date.now(),
}
return await setDoc(ref, view)
}