This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
//The move class. This will be instantiated with a row and column argument passed based on user input | |
class Move { | |
int r; | |
int c; | |
Move(int r, int c) { | |
this.r=r; | |
this.c=c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User } from '../../../models'; | |
export interface UserState { | |
data: User | null; | |
users: User[] | null; | |
} | |
export const initialUserState : UserState = { | |
data: null, | |
users: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User } from '../../../models'; | |
export interface UserState { | |
data: User | null; | |
users: User[] | null; | |
} | |
export const initialUserState : UserState = { | |
data: null, | |
users: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User } from './User'; | |
export interface Post { | |
id: number; | |
title: string; | |
content: string; | |
createdAt: Date; | |
author: User | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Post } from '../../../models'; | |
export interface PostState { | |
data: Post | null; | |
posts: Post[] | null; | |
} | |
export const initialPostState: PostState = { | |
data: null, | |
posts: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { User } from '../../models'; | |
import { PostService } from '../post'; | |
@Injectable() | |
export class UserService { | |
public db: User[] = []; | |
constructor(private postService: PostService) {} | |
insert(user: User) : void { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Post, User } from '../../models'; | |
let id: number = 1; | |
@Injectable() | |
export class PostService { | |
public db: Post[] = []; | |
constructor() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Action } from '@ngrx/store'; | |
import { User } from '../../../models'; | |
export enum UserActionTypes { | |
LoadUserPing = '[User] Ping To Load User', | |
LoadUsersPing = '[User] Ping To Load Users', | |
LoadUser = '[User] Load A User', | |
LoadUsers = '[User] Load All Users' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Action } from '@ngrx/store'; | |
import { Post } from '../../../models'; | |
export enum PostActionTypes { | |
LoadPostPing = '[Post] Ping To Load A Post', | |
LoadPostsPing = '[Post] Ping To Load All Posts', | |
LoadPost = '[Post] Load A Post', | |
LoadPosts = '[Post] Load All Posts' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { UserState, initialUserState } from '../../states'; | |
import { UserActionTypes, UserActionUnion } from '../../actions'; | |
export default (state: UserState = initialUserState, action: UserActionUnion) : UserState => { | |
switch (action.type) { | |
case UserActionTypes.LoadUser: | |
return { | |
...state, |
OlderNewer