123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- import { Action } from '@ngrx/store';
- import { User } from 'src/app/shared/models/user/user.model';
- import { UserActionTypes } from './user.action.types';
-
- /**create actions related to a user*/
-
- // Actios of creating a user form to add user
- export class CreateFormUserAddAction implements Action {
- type: UserActionTypes = UserActionTypes.CREATE_FORM_ADD_USER;
- constructor(public payload: any) {}
- }
-
- export class CreateFormUserAddActionSuccess implements Action {
- type: UserActionTypes = UserActionTypes.CREATE_FORM_ADD_USER_SUCCESS;
- constructor(public payload: any) {}
- }
-
- export class CreateFormUserAddActionError implements Action {
- type: UserActionTypes = UserActionTypes.CREATE_FORM_ADD_USER_ERROR;
- constructor(public payload: string) {}
- }
-
- //actions of saving a user form data
- export class SaveUserFormAddAction implements Action {
- type: UserActionTypes = UserActionTypes.SAVE_USERFORM_ADD;
- constructor(public payload: User) {}
- }
-
- export class SaveUserFormAddActionSuccess implements Action {
- type: UserActionTypes = UserActionTypes.SAVE_USERFORM_ADD_SUCCESS;
- constructor(public payload: User) {}
- }
-
- export class SaveUserFormAddActionError implements Action {
- type: UserActionTypes = UserActionTypes.SAVE_USERFORM_ADD_ERROR;
- constructor(public payload: string) {}
- }
-
- //get all users actions
- export class GetAllUsersAction implements Action {
- type: UserActionTypes = UserActionTypes.GET_ALL_USERS;
-
- constructor(public payload: any) {}
- }
-
- export class GetAllUsersActionSuccess implements Action {
- type: UserActionTypes = UserActionTypes.GET_ALL_USERS_SUCCESS;
- constructor(public payload: User[]) {}
- }
-
- export class GetAllUsersActionError implements Action {
- type: UserActionTypes = UserActionTypes.GET_ALL_USERS_ERROR;
- constructor(public payload: string) {}
- }
-
-
- // Actions of creating a user form to edit user
- export class CreareFormUserEditAction implements Action {
- type: UserActionTypes = UserActionTypes.CREATE_FORM_USER_EDIT;
-
- constructor(public payload: User) {}
- }
-
- export class CreareFormUserEditActionSuccess implements Action {
- type: UserActionTypes = UserActionTypes.CREATE_FORM_USER_EDIT_SUCCESS;
- constructor(public payload: User) {}
- }
-
- export class CreareFormUserEditActionActionError implements Action {
- type: UserActionTypes = UserActionTypes.CREATE_FORM_USER_EDIT_ERROR;
- constructor(public payload: string) {}
- }
-
- // action of updating user from user data form
-
- export class UpdateUserFormAction implements Action {
- type: UserActionTypes = UserActionTypes.UPDATE_USER_FORM;
- constructor(public payload: User) {}
- }
-
- export class UpdateUserFormActionSuccess implements Action {
- type: UserActionTypes = UserActionTypes.UPDATE_USER_FORM_SUCCESS;
- constructor(public payload: User) {}
- }
-
- export class UpdateUserFormActionError implements Action {
- type: UserActionTypes = UserActionTypes.UPDATE_USER_FORM_ERROR;
- constructor(public payload: string) {}
- }
-
- // Actions of deleting a user
- export class DeleteUsersAction implements Action {
- type: UserActionTypes = UserActionTypes.DELETE_A_USER;
-
- constructor(public payload: User) {}
- }
-
- export class DeleteUserActionSuccess implements Action {
- type: UserActionTypes = UserActionTypes.DELETE_A_USER_SUCCESS;
- constructor(public payload: User) {}
- }
-
- export class DeleteUserActionError implements Action {
- type: UserActionTypes = UserActionTypes.DELETE_A_USER_ERROR;
- constructor(public payload: string) {}
- }
-
- //Action of loading user's projects
- export class GetUser_S_Projects implements Action {
- type: UserActionTypes = UserActionTypes.GET_USER_S_PROJECTS;
- constructor(public payload: any) {}
- }
-
- export class GetUser_S_ProjectsSuccess implements Action {
- type: UserActionTypes = UserActionTypes.GET_USER_S_PROJECTS_SUCCESS;
- constructor(public payload: any) {}
- }
-
- export class GetUser_S_ProjectsError implements Action {
- type: UserActionTypes = UserActionTypes.GET_USER_S_PROJECTS_ERROR;
- constructor(public payload: string) {}
- }
-
- //action of navigating to another component
- export class NavigateActionSuccess implements Action {
- type: UserActionTypes =
- UserActionTypes.NAVIGATE_TO_USER_S_PROJECTS_COMPONENT_SUCCESS;
- constructor(public payload: any) {}
- }
-
- export type UserActionUnion =
- | CreateFormUserAddAction
- | CreateFormUserAddActionSuccess
- | CreateFormUserAddActionError
- | SaveUserFormAddAction
- | SaveUserFormAddActionSuccess
- | SaveUserFormAddActionError
- | GetAllUsersAction
- | GetAllUsersActionSuccess
- | GetAllUsersActionError
- | CreareFormUserEditAction
- | CreareFormUserEditActionSuccess
- | CreareFormUserEditActionActionError
- | UpdateUserFormAction
- | UpdateUserFormActionSuccess
- | UpdateUserFormActionError
- | DeleteUsersAction
- | DeleteUserActionSuccess
- | DeleteUserActionError
- | GetUser_S_Projects
- | GetUser_S_ProjectsSuccess
- | GetUser_S_ProjectsError
- | NavigateActionSuccess;
|