feat(firebase): add find firebase realtime database record action

This commit is contained in:
Rıdvan Akca
2024-04-20 14:46:23 +02:00
parent 094c6c0c27
commit 53e97729dc
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Find Firebase Realtime Database Record',
key: 'findFirebaseRealtimeDatabaseRecord',
description: 'Finds a child object in Firebase Realtime Database.',
arguments: [
{
label: 'Path',
key: 'path',
type: 'string',
required: true,
description:
"Indicate the path to the key of the object where the child objects to be queried are located, for example, 'foo/bar/here'.",
variables: true,
},
],
async run($) {
const { path } = $.step.parameters;
const { data } = await $.http.get(`${path}.json`, {
additionalProperties: {
setFirestoreBaseUrl: false,
},
});
$.setActionItem({
raw: data,
});
},
});

View File

@@ -1,9 +1,11 @@
import createCloudFirestoreDocument from './create-cloud-firestore-document/index.js';
import createFirebaseRealtimeDatabaseRecord from './create-firebase-realtime-database-record/index.js';
import findCloudFirestoreDocument from './find-cloud-firestore-document/index.js';
import findFirebaseRealtimeDatabaseRecord from './find-firebase-realtime-database-record/index.js';
export default [
createCloudFirestoreDocument,
createFirebaseRealtimeDatabaseRecord,
findCloudFirestoreDocument,
findFirebaseRealtimeDatabaseRecord,
];

View File

@@ -7,6 +7,8 @@ items:
desc: Creates a child object within your Firebase Realtime Database.
- name: Find Cloud Firestore document
desc: Finds a document within a collection.
- name: Find Firebase Realtime Database Record
desc: Finds a child object in Firebase Realtime Database.
---
<script setup>