Skip to content

Commit 401c135

Browse files
authored
Release
2 parents 0a66fc5 + 420fdf1 commit 401c135

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+728
-158
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Validate Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@master
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 22.0
20+
21+
- name: Install Dependencies
22+
run: |
23+
cd functions
24+
npm install
25+
26+
- name: Build
27+
run: |
28+
cd functions
29+
npm run build
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { initializeApp } from "firebase-admin/app"
22
import { firestore } from "firebase-admin"
33
import { getStorage } from "firebase-admin/storage"
4+
// import { getDownloadURL } from "firebase-admin/storage"
45

56
initializeApp()
67

8+
// export {getDownloadURL}
79
export const database = firestore()
810
export const storage = getStorage()
911
export { File } from '@google-cloud/storage'
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { database } from "./Firebase"
22
export { storage } from "./Firebase"
3-
export { File } from './Firebase'
3+
export { File } from './Firebase'
4+
// export {getDownloadURL} from './Firebase'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { database } from '@data/firebase';
2+
3+
export async function GetFranchiseRepository(): Promise<string[]> {
4+
try {
5+
let franchises = []
6+
const franchisesSnapshot = await database.collection('franchises').get();
7+
if (franchisesSnapshot.empty) {
8+
console.log("No franchises.");
9+
return [];
10+
}
11+
for (const doc of franchisesSnapshot.docs) {
12+
const data = doc.id;
13+
// console.log("GetFranchiseRepository data: ", JSON.stringify(data));
14+
franchises.push(data.toLowerCase())
15+
}
16+
// console.log("GetFranchiseRepository franchises: ", franchises)
17+
return franchises
18+
} catch (error) {
19+
console.error('Error fetching franchises data:', error);
20+
throw error;
21+
}
22+
}
23+
24+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {GetFranchiseRepository} from "./get/franchise/GetFranchiseRepository"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export type ImageDTO = {
2+
image: string | []
3+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { storage } from "@data/firebase";
2+
import { ImageDTO } from "@data/image";
3+
4+
export async function GetImageRepository(image: string): Promise<ImageDTO> {
5+
try {
6+
const imageRef = storage.bucket().file(image);
7+
if (!imageRef) {
8+
console.log('Image does not exist in Firebase Storage');
9+
return { image: [] }; // Empty Base64 string if image doesn't exist
10+
}
11+
12+
const [fileBuffer] = await imageRef.download();
13+
if (!fileBuffer) {
14+
console.log('Failed to download image from Firebase Storage');
15+
return { image: [] }; // Empty Base64 string if download fails
16+
}
17+
18+
// Convert file buffer to Base64
19+
const base64Image = fileBuffer.toString('base64');
20+
const imageResult: ImageDTO = {
21+
image: base64Image,
22+
};
23+
return imageResult;
24+
} catch (error) {
25+
console.error('Error fetching image data:', error);
26+
throw error;
27+
}
28+
}

functions/src/data/image/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { ImageDTO } from "./get/image/DTO/ImageDTO"
2+
export { GetImageRepository } from "./get/image/GetImageRepository"

functions/src/data/place/get/place/DTO/PlaceDTO.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export type PlaceDTO = {
66
id: string,
77
displayName: LocalizedTextDTO,
88
addressComponents: AddressComponentsDTO[],
9-
location: LatLngDTO
9+
location: LatLngDTO | null
1010
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type GetPlacesRepositoryRequest = {
2+
searchText: string
3+
nextPageToken?: string
4+
userLocation?: { latitude: number, longitude: number }
5+
}

0 commit comments

Comments
 (0)