Resources booking API with Firestore database
Budget: $30 – $250 USD
You will have to code Google Cloud Functions API on a Firestore database. Here a brief definition on how the APIs will have to work.
The following APIs allow to manage the reservation of resources by users of a web application, the identification of users and access management are managed by an external system that assigns each user a token that can be validated through the function isUserAllowed(token, functionName) which returns a boolean.
For the development of the management API the developer will insert in his project, inside a utils file, a generic function:
function isUserAllowed(string token, string functionName) {
//token is the session token assigned to the user
//functionName is a string representing the name of the function to authorize
if (token && functionName) return true
return false;
}
Each API before performing the requested operation will verify access via a call similar to:
function exampleFunction(token, ...) {
if ( !isUserAllowed( token, ‘exampleFunction’ ) return NOT_ALLOWED;
[...]
}
Management of the application objects
All objects declared by the application can be managed through very similar functions, in particular each object will have the following standard functions available:
listResources()
addResource()
getResource()
editResource()
activateResource()
deactivateResource()
The objects managed through these functions are:
resourceCalendar : is an object that defines availability calendars, for each calendar is defined
calendar name
a start validity date
an end validity date
an array of days of the week (Monday, Tuesday, Wednesday, etc. plus an all value), if this array is empty the resource is not available for any day of the week, otherwise it is available for all the days of the week present (Monday, Tuesday, all, etc)
an array of time slots defined as: start time, end time, minimum duration, maximum duration, minimum slot duration (if defined at 10 minutes, for example, it allows booking only at times that are the start time plus a number of 10 minute slots multiplied by an integer number, e.g.: 8:10, 8:20, 8:30, etc.)
resource : identifies a reservable resource, this is not an abstraction, it maps exactly a resource, so for example the APPLE meeting room, the car with license plate AA123BB, etc.
Each resource declares an array of availability calendars:
calendar id
resource available / not available flag
The availability calendar of the resource is the sum of all calendars with flag available, from which all calendars with flag unavailable are subtracted.
In this way to say that the service is active every day from Monday to Friday except for the month of August in which the service is available only on Tuesday, we will create two calendars, one Mon-Fri without start or end date which we will call "open on working days", the other with the unavailable flag starting on the first of August and ending on the last of August, which declares as unavailable the days Monday, Wednesday, Thursday and Friday.
typeOfResource : identifies a grouping of homogeneous resources, so for example meeting rooms, cars, telescopes, etc. Resources with different characteristics should be part of the same type, but define a list of characteristics, resource types are used to define a category of resources that forms a group, a family.
Each resource type defines a list of attributes that can be enhanced for the resource type, for example a "meeting room" resource type will define as attributes: number of seats, projector, projector resolution, windows, video conferencing system, etc.
The resource type attributes are key/value pairs, where the key is a unique random and the value a text string.
[...] see attached document
The following APIs allow to manage the reservation of resources by users of a web application, the identification of users and access management are managed by an external system that assigns each user a token that can be validated through the function isUserAllowed(token, functionName) which returns a boolean.
For the development of the management API the developer will insert in his project, inside a utils file, a generic function:
function isUserAllowed(string token, string functionName) {
//token is the session token assigned to the user
//functionName is a string representing the name of the function to authorize
if (token && functionName) return true
return false;
}
Each API before performing the requested operation will verify access via a call similar to:
function exampleFunction(token, ...) {
if ( !isUserAllowed( token, ‘exampleFunction’ ) return NOT_ALLOWED;
[...]
}
Management of the application objects
All objects declared by the application can be managed through very similar functions, in particular each object will have the following standard functions available:
listResources()
addResource()
getResource()
editResource()
activateResource()
deactivateResource()
The objects managed through these functions are:
resourceCalendar : is an object that defines availability calendars, for each calendar is defined
calendar name
a start validity date
an end validity date
an array of days of the week (Monday, Tuesday, Wednesday, etc. plus an all value), if this array is empty the resource is not available for any day of the week, otherwise it is available for all the days of the week present (Monday, Tuesday, all, etc)
an array of time slots defined as: start time, end time, minimum duration, maximum duration, minimum slot duration (if defined at 10 minutes, for example, it allows booking only at times that are the start time plus a number of 10 minute slots multiplied by an integer number, e.g.: 8:10, 8:20, 8:30, etc.)
resource : identifies a reservable resource, this is not an abstraction, it maps exactly a resource, so for example the APPLE meeting room, the car with license plate AA123BB, etc.
Each resource declares an array of availability calendars:
calendar id
resource available / not available flag
The availability calendar of the resource is the sum of all calendars with flag available, from which all calendars with flag unavailable are subtracted.
In this way to say that the service is active every day from Monday to Friday except for the month of August in which the service is available only on Tuesday, we will create two calendars, one Mon-Fri without start or end date which we will call "open on working days", the other with the unavailable flag starting on the first of August and ending on the last of August, which declares as unavailable the days Monday, Wednesday, Thursday and Friday.
typeOfResource : identifies a grouping of homogeneous resources, so for example meeting rooms, cars, telescopes, etc. Resources with different characteristics should be part of the same type, but define a list of characteristics, resource types are used to define a category of resources that forms a group, a family.
Each resource type defines a list of attributes that can be enhanced for the resource type, for example a "meeting room" resource type will define as attributes: number of seats, projector, projector resolution, windows, video conferencing system, etc.
The resource type attributes are key/value pairs, where the key is a unique random and the value a text string.
[...] see attached document