Skip to content

Commit 308a582

Browse files
author
Mateo
committed
feat: added all crud boilerplate
1 parent ca85343 commit 308a582

File tree

428 files changed

+12197
-1803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

428 files changed

+12197
-1803
lines changed

angular.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
"projects/craftsjs-app/src/assets"
2929
],
3030
"styles": [
31-
"projects/craftsjs-app/src/styles.scss"
31+
"projects/craftsjs-app/src/styles.scss",
32+
"projects/craftsjs-app/src/styles/font-awesome/css/all.min.css"
3233
],
33-
"scripts": []
34+
"scripts": [],
35+
"preserveSymlinks": true
3436
},
3537
"configurations": {
3638
"production": {

package.json

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,50 @@
88
"test": "ng test",
99
"lint": "ng lint",
1010
"e2e": "ng e2e",
11-
"build:libs": "ng build @craftsjs/boilerplate",
11+
"build:libs": "ng build @craftsjs/boilerplate --prod",
1212
"test:libs": "ng test @craftsjs/boilerplate",
13-
"add:lib": "ng generate library"
13+
"add:lib": "ng generate library",
14+
"postinstall": "ngcc --properties es5 browser module main --first-only --create-ivy-entry-points && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
1415
},
1516
"private": true,
1617
"dependencies": {
17-
"@addapptables/alert": "^2.0.0",
18-
"@addapptables/card": "^2.0.0",
19-
"@addapptables/core": "^2.0.0",
20-
"@addapptables/menu": "^2.1.1",
21-
"@addapptables/modal": "^2.0.0",
22-
"@addapptables/ngrx-actions": "^2.0.0",
23-
"@addapptables/notifier": "^2.1.0",
24-
"@addapptables/perfect-scrollbar": "^2.0.0",
25-
"@addapptables/responsive": "^2.0.0",
26-
"@angular/animations": "~9.0.7",
18+
"@angular/animations": "^9.1.0",
2719
"@angular/cdk": "^9.2.0",
28-
"@angular/common": "~9.0.7",
29-
"@angular/compiler": "~9.0.7",
30-
"@angular/core": "~9.0.7",
31-
"@angular/forms": "~9.0.7",
20+
"@angular/common": "^9.1.0",
21+
"@angular/compiler": "^9.1.0",
22+
"@angular/core": "^9.1.0",
23+
"@angular/forms": "^9.1.0",
24+
"@angular/localize": "^9.1.0",
3225
"@angular/material": "^9.2.0",
33-
"@angular/platform-browser": "~9.0.7",
34-
"@angular/platform-browser-dynamic": "~9.0.7",
35-
"@angular/router": "~9.0.7",
26+
"@angular/platform-browser": "^9.1.0",
27+
"@angular/platform-browser-dynamic": "^9.1.0",
28+
"@angular/router": "^9.1.0",
3629
"@ngrx/effects": "^9.0.0",
3730
"@ngrx/entity": "^9.0.0",
3831
"@ngrx/router-store": "^9.0.0",
3932
"@ngrx/store": "^9.0.0",
4033
"@ngrx/store-devtools": "^9.0.0",
34+
"angular-l10n": "^9.1.0",
4135
"materialize-css": "^1.0.0",
36+
"moment": "^2.24.0",
37+
"ng2-file-upload": "^1.4.0",
38+
"ngx-cookie-service": "^3.0.3",
39+
"ngx-img-cropper": "^9.0.1",
4240
"normalize-scss": "^7.0.1",
4341
"perfect-scrollbar": "^1.5.0",
4442
"rxjs": "~6.5.4",
4543
"tslib": "^1.10.0",
4644
"zone.js": "~0.10.2"
4745
},
4846
"devDependencies": {
49-
"@angular-devkit/build-angular": "~0.900.7",
50-
"@angular-devkit/build-ng-packagr": "~0.900.7",
51-
"@angular/cli": "~9.0.7",
52-
"@angular/compiler-cli": "~9.0.7",
53-
"@angular/language-service": "~9.0.7",
47+
"@angular-devkit/build-angular": "^0.901.0",
48+
"@angular-devkit/build-ng-packagr": "^0.901.0",
49+
"@angular/cli": "^9.1.0",
50+
"@angular/compiler-cli": "^9.1.0",
51+
"@angular/language-service": "^9.1.0",
5452
"@types/jasmine": "~3.5.0",
5553
"@types/jasminewd2": "~2.0.3",
54+
"@types/lodash": "^4.14.149",
5655
"@types/node": "^12.11.1",
5756
"codelyzer": "^5.1.2",
5857
"jasmine-core": "~3.5.0",
@@ -66,6 +65,6 @@
6665
"protractor": "~5.4.3",
6766
"ts-node": "~8.3.0",
6867
"tslint": "~5.18.0",
69-
"typescript": "~3.7.5"
68+
"typescript": "3.8.3"
7069
}
7170
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { createAction, props } from '@ngrx/store';
2+
import { EditionDto } from '../models/edition-dto.model';
3+
import { GetEditionDto } from '../models/get-edition-dto.model';
4+
import { CreateEditionDto } from '../models/create-edition-dto.model';
5+
import { UpdateEditionDto } from '../models/update-edition-dto.model';
6+
7+
export enum EditionActionTypes {
8+
LoadEditions = '[Edition] Load Editions',
9+
EditionsLoaded = '[Edition] Editions Loaded',
10+
CreateEdition = '[Edition] Create Edition',
11+
EditionCreated = '[Edition] Edition Created',
12+
UpdateEdition = '[Edition] Update Edition',
13+
EditionUpdated = '[Edition] Edition Updated',
14+
DeleteEdition = '[Edition] Delete Edition',
15+
EditionDeleted = '[Edition] Edition Deleted',
16+
EditionActionComplete = '[Edition] Edition Action Complete',
17+
EditionActionError = '[Edition] Edition Action Error',
18+
EditionClearStore = '[Edition] Edition Clear Store',
19+
CancelEditionRequest = '[Edition] Cancel Edition Request',
20+
}
21+
22+
export const cancelEditionRequest = createAction(EditionActionTypes.CancelEditionRequest);
23+
24+
export const editionClearStore = createAction(EditionActionTypes.EditionClearStore);
25+
26+
export const editionActionError = createAction(EditionActionTypes.EditionActionError);
27+
28+
export const editionActionComplete = createAction(EditionActionTypes.EditionActionComplete);
29+
30+
export const editionDeleted = createAction(EditionActionTypes.EditionDeleted, props<{ payload: { id: string } }>());
31+
32+
export const deleteEdition = createAction(EditionActionTypes.DeleteEdition, props<{ payload: { id: string } }>());
33+
34+
export const editionUpdated = createAction(EditionActionTypes.EditionUpdated, props<{ payload: { edition: EditionDto } }>());
35+
36+
export const updateEdition = createAction(EditionActionTypes.UpdateEdition, props<{ payload: { edition: UpdateEditionDto } }>());
37+
38+
export const editionCreated = createAction(EditionActionTypes.EditionCreated, props<{ payload: { edition: EditionDto } }>());
39+
40+
export const createEdition = createAction(EditionActionTypes.CreateEdition, props<{ payload: { edition: CreateEditionDto } }>());
41+
42+
export const editionsLoaded = createAction(EditionActionTypes.EditionsLoaded,
43+
props<{ payload: { editions: EditionDto[], total: number } }>());
44+
45+
export const loadEditions = createAction(EditionActionTypes.LoadEditions, props<{ payload: { filter: GetEditionDto } }>());
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { Injectable } from '@angular/core';
2+
import { Actions, createEffect, ofType } from '@ngrx/effects';
3+
import { EditionService } from '../services/edition.service';
4+
import { switchMap, takeUntil, catchError, map } from 'rxjs/operators';
5+
import { of } from 'rxjs';
6+
import { PaginatedModel } from '@redux/shared/models/paginated.model';
7+
import { EditionDto } from '../models/edition-dto.model';
8+
import * as editionActions from '../actions/edition.actions';
9+
10+
@Injectable()
11+
export class EditionEffects {
12+
13+
constructor(
14+
private _actions$: Actions,
15+
private _editionService: EditionService
16+
) { }
17+
18+
loadData$ = createEffect(() => this._actions$.pipe(
19+
ofType(editionActions.loadEditions),
20+
switchMap((action) =>
21+
this._editionService.getAll(action.payload.filter).pipe(
22+
takeUntil(this._actions$.pipe(ofType(editionActions.cancelEditionRequest))),
23+
catchError(() => of({ total: 0, data: [] } as PaginatedModel<EditionDto>))
24+
)
25+
),
26+
map((result) => editionActions.editionsLoaded({ payload: { editions: result.data, total: result.total } }))
27+
));
28+
29+
$create = createEffect(() => this._actions$.pipe(
30+
ofType(editionActions.createEdition),
31+
switchMap((action) =>
32+
this._editionService.create(action.payload.edition).pipe(
33+
takeUntil(this._actions$.pipe(ofType(editionActions.cancelEditionRequest))),
34+
map((edition) => editionActions.editionCreated({ payload: { edition } })),
35+
catchError(() => of(editionActions.editionActionError()))
36+
)
37+
)
38+
));
39+
40+
$update = createEffect(() => this._actions$.pipe(
41+
ofType(editionActions.updateEdition),
42+
switchMap((action) =>
43+
this._editionService.update(action.payload.edition).pipe(
44+
takeUntil(this._actions$.pipe(ofType(editionActions.cancelEditionRequest))),
45+
map((edition) => editionActions.editionUpdated({ payload: { edition } })),
46+
catchError(() => of(editionActions.editionActionError()))
47+
)
48+
)
49+
));
50+
51+
$delete = createEffect(() => this._actions$.pipe(
52+
ofType(editionActions.deleteEdition),
53+
switchMap((action) =>
54+
this._editionService.deleteEdition(action.payload.id).pipe(
55+
takeUntil(this._actions$.pipe(ofType(editionActions.cancelEditionRequest))),
56+
map(() => editionActions.editionDeleted({ payload: { id: action.payload.id } })),
57+
catchError(() => of(editionActions.editionActionError()))
58+
)
59+
)
60+
));
61+
62+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { EditionType } from './edition-type.enum';
2+
3+
export class CreateEditionDto {
4+
name: string;
5+
isFree: boolean;
6+
price?: number;
7+
numberOfUsers?: number;
8+
trialDayCount?: number;
9+
editionType?: EditionType;
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { EditionType } from './edition-type.enum';
2+
3+
export class EditionDto {
4+
id: string;
5+
name: string;
6+
isFree: boolean;
7+
price?: number;
8+
numberOfUsers?: number;
9+
trialDayCount?: number;
10+
editionType?: EditionType;
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { StoreModel } from '@redux/shared/models/store.model';
2+
import { EditionDto } from './edition-dto.model';
3+
4+
export interface EditionStoreModel extends StoreModel<EditionDto> { }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
export enum EditionType {
3+
Monthly = 1,
4+
Biannual = 2,
5+
Annual = 3,
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { GetPaginated } from '@redux/shared/models/get-paginated.model';
2+
3+
export class GetEditionDto extends GetPaginated {
4+
name?: string;
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { CreateEditionDto } from './create-edition-dto.model';
2+
3+
export class UpdateEditionDto extends CreateEditionDto {
4+
id: string;
5+
}

0 commit comments

Comments
 (0)