Denormalize the avatar URL on contract creation (#29)
This commit is contained in:
parent
279437ba08
commit
7d7286b1c1
|
@ -5,6 +5,7 @@ export type Contract = {
|
|||
creatorId: string
|
||||
creatorName: string
|
||||
creatorUsername: string
|
||||
creatorAvatarUrl?: string // Start requiring after Mar 01, 2022
|
||||
|
||||
question: string
|
||||
description: string // More info about what the contract is about
|
||||
|
|
|
@ -24,6 +24,7 @@ export function getNewContract(
|
|||
creatorId: creator.id,
|
||||
creatorName: creator.name,
|
||||
creatorUsername: creator.username,
|
||||
creatorAvatarUrl: creator.avatarUrl,
|
||||
|
||||
question: question.trim(),
|
||||
description: description.trim(),
|
||||
|
|
|
@ -69,14 +69,6 @@ export async function updateContract(
|
|||
await updateDoc(docRef, update)
|
||||
}
|
||||
|
||||
export async function pushNewContract(contract: Omit<Contract, 'id'>) {
|
||||
const newContractRef = doc(contractCollection)
|
||||
const fullContract: Contract = { ...contract, id: newContractRef.id }
|
||||
|
||||
await setDoc(newContractRef, fullContract)
|
||||
return fullContract
|
||||
}
|
||||
|
||||
export async function getContractFromId(contractId: string) {
|
||||
const docRef = doc(db, 'contracts', contractId)
|
||||
const result = await getDoc(docRef)
|
||||
|
|
Loading…
Reference in New Issue
Block a user