[U] add user to story model. user service minor fixes
This commit is contained in:
parent
99439ee7f6
commit
6880d9c033
2 changed files with 8 additions and 3 deletions
|
|
@ -1,7 +1,10 @@
|
|||
import { User } from './user';
|
||||
|
||||
export class Story {
|
||||
id: string;
|
||||
standup_id: number;
|
||||
user_id: string
|
||||
user_id: string;
|
||||
user?: User;
|
||||
src: string;
|
||||
created_at: string | Date;
|
||||
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@ export class UserService {
|
|||
* Retrieve users from local store.
|
||||
* @param id
|
||||
*/
|
||||
getOne(id: number) {
|
||||
getOne(id: string) {
|
||||
if (this.userMap[id]) {
|
||||
return of(this.userMap[id]);
|
||||
} else {
|
||||
const subject: Subject<User> = new Subject();
|
||||
this.supa.client.from<User>('user').select('id, name, description')
|
||||
this.supa.client.from<User>('user').select()
|
||||
.filter(<never>'id', 'eq', id)
|
||||
.then(data => {
|
||||
this.updateStore([data.body[0]]);
|
||||
|
|
@ -109,6 +109,7 @@ export class UserService {
|
|||
.match({ id: user.id })
|
||||
.then(data => {
|
||||
subject.next(data.body[0]);
|
||||
this.updateStore([data.body[0]]);
|
||||
subject.complete();
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
@ -147,6 +148,7 @@ export class UserService {
|
|||
this.supa.client.from<User>('user').insert(user)
|
||||
.then(data => {
|
||||
subject.next(data.body[0]);
|
||||
this.updateStore([data.body[0]]);
|
||||
subject.complete();
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue