-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin): adding admin module to manage notifications
admin module showcase role based security and push notifications managment
- Loading branch information
Showing
53 changed files
with
1,337 additions
and
85 deletions.
There are no files selected for viewing
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
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
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
48 changes: 48 additions & 0 deletions
48
apps/api/src/app/notifications/notification/dto/update-notification.dto.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ApiModelProperty, ApiModelPropertyOptional } from '@nestjs/swagger'; | ||
import { IsAscii, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString, MaxLength, MinLength } from 'class-validator'; | ||
import { NotificationColor, NotificationIcon, TargetType } from '../notification.entity'; | ||
import { Column, Index } from 'typeorm'; | ||
|
||
export class UpdateNotificationDto { | ||
@ApiModelProperty({ type: String, minLength: 10, maxLength: 100 }) | ||
@IsNotEmpty() | ||
@IsString() | ||
readonly title: string; | ||
|
||
@ApiModelProperty({ type: String, minLength: 10, maxLength: 100 }) | ||
@IsNotEmpty() | ||
@IsString() | ||
readonly body: string; | ||
|
||
@ApiModelProperty({ type: String, minLength: 3, maxLength: 50 }) | ||
@IsNotEmpty() | ||
@IsAscii() | ||
@MinLength(3) | ||
@MaxLength(50) | ||
readonly target: string; | ||
|
||
@ApiModelProperty({ type: String, enum: TargetType }) | ||
@IsNotEmpty() | ||
@IsEnum(TargetType) | ||
readonly targetType: TargetType; | ||
|
||
@ApiModelPropertyOptional({ type: String, enum: NotificationIcon, default: NotificationIcon.NOTIFICATIONS }) | ||
@IsOptional() | ||
@IsEnum(NotificationIcon) | ||
readonly icon?: NotificationIcon; | ||
|
||
@ApiModelPropertyOptional({ type: String, enum: NotificationColor, default: NotificationColor.PRIMARY }) | ||
@IsOptional() | ||
@IsEnum(NotificationColor) | ||
readonly color?: NotificationColor; | ||
|
||
@ApiModelPropertyOptional({ type: Boolean, default: false }) | ||
@IsOptional() | ||
@IsBoolean() | ||
readonly native?: boolean; | ||
|
||
@ApiModelPropertyOptional({ type: Boolean, default: false }) | ||
@IsOptional() | ||
@Index() | ||
readonly read?: boolean; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
name: 'admin', | ||
preset: '../../jest.config.js', | ||
coverageDirectory: '../../coverage/libs/admin', | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './lib/admin.module'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { async, TestBed } from '@angular/core/testing'; | ||
import { AdminModule } from './admin.module'; | ||
|
||
describe('AdminModule', () => { | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [AdminModule], | ||
}).compileComponents(); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(AdminModule).toBeDefined(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { SharedModule } from '@ngx-starter-kit/shared'; | ||
import { DragDropModule } from '@angular/cdk/drag-drop'; | ||
import { AppConfirmModule } from '@ngx-starter-kit/app-confirm'; | ||
import { HelperModule, TruncateModule } from '@ngx-starter-kit/ngx-utils'; | ||
import { OverviewComponent } from './containers/overview/overview.component'; | ||
import { SubscriptionsComponent } from './containers/subscriptions/subscriptions.component'; | ||
import { SubscriptionDetailComponent } from './components/subscription-detail/subscription-detail.component'; | ||
import { NotificationsComponent } from './containers/notifications/notifications.component'; | ||
import { NotificationDetailComponent } from './components/notification-detail/notification-detail.component'; | ||
import { NotificationEditComponent } from './components/notification-edit/notification-edit.component'; | ||
import { AdminLayoutComponent } from './containers/admin-layout/admin-layout.component'; | ||
import { ToolbarModule } from '@ngx-starter-kit/toolbar'; | ||
import { QuickpanelModule } from '@ngx-starter-kit/quickpanel'; | ||
import { AdminGuard } from '@ngx-starter-kit/auth'; | ||
import { FormlyModule } from '@ngx-formly/core'; | ||
import { FormlyMaterialModule } from '@ngx-formly/material'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
SharedModule, | ||
DragDropModule, | ||
AppConfirmModule, | ||
TruncateModule, | ||
HelperModule, | ||
ToolbarModule, | ||
QuickpanelModule, | ||
FormlyModule.forRoot(), | ||
FormlyMaterialModule, | ||
RouterModule.forChild([ | ||
/* {path: '', pathMatch: 'full', component: InsertYourComponentHere} */ | ||
{ | ||
path: '', | ||
component: AdminLayoutComponent, | ||
canActivate: [AdminGuard], | ||
data: { title: 'Admin', depth: 1 }, | ||
children: [ | ||
{ path: '', component: OverviewComponent, data: { title: 'Overview', depth: 2 } }, | ||
{ | ||
path: 'subscriptions', | ||
component: SubscriptionsComponent, | ||
data: { title: 'Subscriptions', depth: 3 }, | ||
children: [ | ||
{ | ||
path: ':id', | ||
component: SubscriptionDetailComponent, | ||
data: { title: 'Subscription Detail' }, | ||
}, | ||
], | ||
}, | ||
{ | ||
path: 'notifications', | ||
component: NotificationsComponent, | ||
data: { title: 'Notifications', depth: 3 }, | ||
children: [ | ||
{ | ||
path: ':id', | ||
component: NotificationDetailComponent, | ||
data: { title: 'Notification Detail' }, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
]), | ||
], | ||
declarations: [ | ||
OverviewComponent, | ||
NotificationsComponent, | ||
SubscriptionsComponent, | ||
SubscriptionDetailComponent, | ||
NotificationDetailComponent, | ||
NotificationEditComponent, | ||
AdminLayoutComponent, | ||
], | ||
entryComponents: [NotificationEditComponent], | ||
}) | ||
export class AdminModule {} |
15 changes: 15 additions & 0 deletions
15
libs/admin/src/lib/components/notification-detail/notification-detail.component.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<mat-card [@fadeAnimation]="animationTrigger$ | async"> | ||
<mat-card-header> | ||
<mat-card-title><h3>Selected Notification</h3></mat-card-title> | ||
</mat-card-header> | ||
<mat-divider></mat-divider> | ||
<mat-card-content> | ||
<mat-list role="list"> | ||
<mat-list-item *ngFor="let entry of (notification | keyvalue)" role="listitem"> | ||
<div> | ||
<span>{{ entry.key }}:</span><span>{{ entry.value | json }}</span> | ||
</div> | ||
</mat-list-item> | ||
</mat-list> | ||
</mat-card-content> | ||
</mat-card> |
Empty file.
Oops, something went wrong.