-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
46 lines (36 loc) · 1.15 KB
/
index.ts
File metadata and controls
46 lines (36 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { FastFire, FastFireDocument } from './src';
import firebase from 'firebase/compat/app';
import { FastFireField } from './dist';
// const firebaseConfig = {
// apiKey: process.env.apiKey,
// authDomain: process.env.authDomain,
// projectId: process.env.projectId,
// storageBucket: process.env.storageBucket,
// messagingSenderId: process.env.messagingSenderId,
// appId: process.env.appId,
// };
const firebaseConfig = {
apiKey: 'AIzaSyBeNk3HlfxpCz7VM0M7dlBSKgD5lxs2LLg',
authDomain: 'desktour-dev.firebaseapp.com',
projectId: 'desktour-dev',
storageBucket: 'desktour-dev.appspot.com',
messagingSenderId: '422473705553',
appId: '1:422473705553:web:43d7b2a303d38f7eb77070',
};
firebase.initializeApp(firebaseConfig);
FastFire.initialize(firebase.firestore());
export class Desk extends FastFireDocument<Desk> {
@FastFireField()
mainImageUrl!: string;
@FastFireField()
description!: string;
@FastFireField()
tags!: string[];
@FastFireField()
createdAt!: Date;
}
const exec = async () => {
const desk = await FastFire.findById(Desk, '28qSVhNds05fKyxqcuBy');
console.log(desk);
};
exec().catch(e => console.error(e));