Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
feat: Create new listdata api
Browse files Browse the repository at this point in the history
  • Loading branch information
Sansai-snct committed Dec 16, 2022
1 parent c7495be commit e6f7932
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/libs/firebase/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ import {
addDoc,
collection,
doc,
getDoc,
getDocs,
query,
updateDoc,
CollectionReference,
DocumentData,
} from "firebase/firestore";
import type { CollectionReference } from "firebase/firestore";
import { getDownloadURL } from "firebase/storage";
import { db } from "./init";
import { uploadImage } from "./storage";
import type {
CreateStoreCardListItem,
CreateStoreMenuListItem,
ListInfo,
StoreCardList,
StoreCardListItem,
StoreMenuList,
Expand Down Expand Up @@ -99,3 +102,10 @@ export const getCardList = async (

return list;
};

export const getInfo = async (uuid: string, listid: string) => {
const ref = doc(db, "Users", uuid, "List", listid);
const docRef: DocumentData = await getDoc(ref);

return docRef.data();
};
6 changes: 6 additions & 0 deletions src/libs/firebase/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ export type CreateStoreCardListItem = {
imageFile?: File;
};

export type ListInfo = {
title: string;
name: string;
id: string;
};

export type StoreCardList = StoreCardListItem[];

0 comments on commit e6f7932

Please sign in to comment.