Skip to content

Commit

Permalink
Merge pull request #30 from jphacks/feature/#27
Browse files Browse the repository at this point in the history
Feature/#27
  • Loading branch information
yuto-trd authored Oct 26, 2024
2 parents 50ce4b1 + 8211b92 commit 7456e5f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions task_yell/src/lib/events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Event } from "./types";
import {
createData,
readData,
readSingleData,
updateData,
deleteData,
} from "../firebase/firestore";
const COLLECTION_NAME = "events";

export async function createEvent(event: Event): Promise<string> {
return createData(COLLECTION_NAME, event);
}

export async function readEvents(): Promise<Event[]> {
return readData<Event>(COLLECTION_NAME);
}

export async function readSingleEvent(id: string): Promise<Event | null> {
return readSingleData<Event>(COLLECTION_NAME, id);
}

export async function updateEvent(
id: string,
eventData: Partial<Event>
): Promise<void> {
return updateData<Event>(COLLECTION_NAME, id, eventData);
}

export async function deleteEvent(id: string): Promise<void> {
return deleteData(COLLECTION_NAME, id);
}

0 comments on commit 7456e5f

Please sign in to comment.