Booking
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 1m57s
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 1m57s
This commit is contained in:
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
|
||||
import type { Reservation } from './schedule.types';
|
||||
import { computed, ref } from 'vue';
|
||||
import { AppwriteIds, databases } from 'src/boot/appwrite';
|
||||
import { Query } from 'appwrite';
|
||||
import { ID, Query } from 'appwrite';
|
||||
import { date } from 'quasar';
|
||||
import { Timestamp, parseDate, today } from '@quasar/quasar-ui-qcalendar';
|
||||
|
||||
@@ -42,6 +42,19 @@ export const useReservationStore = defineStore('reservation', () => {
|
||||
setDateLoaded(startDate, endDate, undefined);
|
||||
}
|
||||
};
|
||||
const createReservation = async (reservation: Reservation) => {
|
||||
try {
|
||||
const response = await databases.createDocument(
|
||||
AppwriteIds.databaseId,
|
||||
AppwriteIds.collection.reservation,
|
||||
ID.unique(),
|
||||
reservation
|
||||
);
|
||||
reservations.value.set(response.$id, response as Reservation);
|
||||
} catch (e) {
|
||||
console.error('Error creating Reservation: ' + e);
|
||||
}
|
||||
};
|
||||
|
||||
// Set the loading state for dates
|
||||
const setDateLoaded = (start: Date, end: Date, state: LoadingTypes) => {
|
||||
@@ -124,6 +137,7 @@ export const useReservationStore = defineStore('reservation', () => {
|
||||
|
||||
return {
|
||||
getReservationsByDate,
|
||||
createReservation,
|
||||
fetchReservationsForDateRange,
|
||||
isReservationOverlapped,
|
||||
isResourceTimeOverlapped,
|
||||
|
||||
Reference in New Issue
Block a user