first commit

This commit is contained in:
2024-04-19 12:53:45 +07:00
commit 71a3a661dc
1943 changed files with 246917 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { UserService } from './user.service';
describe('UserService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: UserService = TestBed.get(UserService);
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,27 @@
import { Injectable } from '@angular/core';
import { AngularFirestore } from '@angular/fire/compat/firestore';
import firebase from 'firebase/compat/app';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class UserService {
ref = firebase.firestore().collection('users');
constructor(private firestore: AngularFirestore) {
}
getUsers() {
return this.firestore.collection('users').snapshotChanges();
}
getCurrentUser(userId): Observable<any> {
return this.firestore.collection('users', ref => ref.where('uid', '==', userId)).snapshotChanges();
}
createUser(user) {
return this.ref.add(user);
}
}