From 947586c71d91a1c6cf9b091ecd55605334e37ca0 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Wed, 12 Oct 2022 19:01:43 -0700 Subject: [PATCH] fixing genreated mock database. fixing time on toasts. --- backend/pkg/database/mock/mock_database.go | 177 ------------------ frontend/src/app/components/shared.module.ts | 2 + .../app/components/toast/toast.component.html | 2 +- frontend/src/app/models/fasten/toast.ts | 1 + 4 files changed, 4 insertions(+), 178 deletions(-) diff --git a/backend/pkg/database/mock/mock_database.go b/backend/pkg/database/mock/mock_database.go index 3b101ef3..e6c760b3 100644 --- a/backend/pkg/database/mock/mock_database.go +++ b/backend/pkg/database/mock/mock_database.go @@ -49,20 +49,6 @@ func (mr *MockDatabaseRepositoryMockRecorder) Close() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockDatabaseRepository)(nil).Close)) } -// CreateSource mocks base method. -func (m *MockDatabaseRepository) CreateSource(arg0 context.Context, arg1 *models.Source) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateSource", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// CreateSource indicates an expected call of CreateSource. -func (mr *MockDatabaseRepositoryMockRecorder) CreateSource(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateSource", reflect.TypeOf((*MockDatabaseRepository)(nil).CreateSource), arg0, arg1) -} - // CreateUser mocks base method. func (m *MockDatabaseRepository) CreateUser(arg0 context.Context, arg1 *models.User) error { m.ctrl.T.Helper() @@ -76,166 +62,3 @@ func (mr *MockDatabaseRepositoryMockRecorder) CreateUser(arg0, arg1 interface{}) mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateUser", reflect.TypeOf((*MockDatabaseRepository)(nil).CreateUser), arg0, arg1) } - -// GetCurrentUser mocks base method. -func (m *MockDatabaseRepository) GetCurrentUser(arg0 context.Context) models.User { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCurrentUser", arg0) - ret0, _ := ret[0].(models.User) - return ret0 -} - -// GetCurrentUser indicates an expected call of GetCurrentUser. -func (mr *MockDatabaseRepositoryMockRecorder) GetCurrentUser(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentUser", reflect.TypeOf((*MockDatabaseRepository)(nil).GetCurrentUser), arg0) -} - -// GetPatientForSources mocks base method. -func (m *MockDatabaseRepository) GetPatientForSources(ctx context.Context) ([]models.ResourceFhir, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetPatientForSources", ctx) - ret0, _ := ret[0].([]models.ResourceFhir) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetPatientForSources indicates an expected call of GetPatientForSources. -func (mr *MockDatabaseRepositoryMockRecorder) GetPatientForSources(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPatientForSources", reflect.TypeOf((*MockDatabaseRepository)(nil).GetPatientForSources), ctx) -} - -// GetResource mocks base method. -func (m *MockDatabaseRepository) GetResource(arg0 context.Context, arg1 string) (*models.ResourceFhir, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetResource", arg0, arg1) - ret0, _ := ret[0].(*models.ResourceFhir) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetResource indicates an expected call of GetResource. -func (mr *MockDatabaseRepositoryMockRecorder) GetResource(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResource", reflect.TypeOf((*MockDatabaseRepository)(nil).GetResource), arg0, arg1) -} - -// GetResourceBySourceId mocks base method. -func (m *MockDatabaseRepository) GetResourceBySourceId(arg0 context.Context, arg1, arg2 string) (*models.ResourceFhir, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetResourceBySourceId", arg0, arg1, arg2) - ret0, _ := ret[0].(*models.ResourceFhir) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetResourceBySourceId indicates an expected call of GetResourceBySourceId. -func (mr *MockDatabaseRepositoryMockRecorder) GetResourceBySourceId(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResourceBySourceId", reflect.TypeOf((*MockDatabaseRepository)(nil).GetResourceBySourceId), arg0, arg1, arg2) -} - -// GetSource mocks base method. -func (m *MockDatabaseRepository) GetSource(arg0 context.Context, arg1 string) (*models.Source, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSource", arg0, arg1) - ret0, _ := ret[0].(*models.Source) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetSource indicates an expected call of GetSource. -func (mr *MockDatabaseRepositoryMockRecorder) GetSource(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSource", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSource), arg0, arg1) -} - -// GetSourceSummary mocks base method. -func (m *MockDatabaseRepository) GetSourceSummary(arg0 context.Context, arg1 string) (*models.SourceSummary, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSourceSummary", arg0, arg1) - ret0, _ := ret[0].(*models.SourceSummary) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetSourceSummary indicates an expected call of GetSourceSummary. -func (mr *MockDatabaseRepositoryMockRecorder) GetSourceSummary(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSourceSummary", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSourceSummary), arg0, arg1) -} - -// GetSources mocks base method. -func (m *MockDatabaseRepository) GetSources(arg0 context.Context) ([]models.Source, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSources", arg0) - ret0, _ := ret[0].([]models.Source) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetSources indicates an expected call of GetSources. -func (mr *MockDatabaseRepositoryMockRecorder) GetSources(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSources", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSources), arg0) -} - -// GetSummary mocks base method. -func (m *MockDatabaseRepository) GetSummary(ctx context.Context) (*models.Summary, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSummary", ctx) - ret0, _ := ret[0].(*models.Summary) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetSummary indicates an expected call of GetSummary. -func (mr *MockDatabaseRepositoryMockRecorder) GetSummary(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSummary", reflect.TypeOf((*MockDatabaseRepository)(nil).GetSummary), ctx) -} - -// GetUserByEmail mocks base method. -func (m *MockDatabaseRepository) GetUserByEmail(arg0 context.Context, arg1 string) (*models.User, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUserByEmail", arg0, arg1) - ret0, _ := ret[0].(*models.User) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetUserByEmail indicates an expected call of GetUserByEmail. -func (mr *MockDatabaseRepositoryMockRecorder) GetUserByEmail(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUserByEmail", reflect.TypeOf((*MockDatabaseRepository)(nil).GetUserByEmail), arg0, arg1) -} - -// ListResources mocks base method. -func (m *MockDatabaseRepository) ListResources(arg0 context.Context, arg1 models.ListResourceQueryOptions) ([]models.ResourceFhir, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListResources", arg0, arg1) - ret0, _ := ret[0].([]models.ResourceFhir) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListResources indicates an expected call of ListResources. -func (mr *MockDatabaseRepositoryMockRecorder) ListResources(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListResources", reflect.TypeOf((*MockDatabaseRepository)(nil).ListResources), arg0, arg1) -} - -// UpsertResource mocks base method. -func (m *MockDatabaseRepository) UpsertResource(arg0 context.Context, arg1 models.ResourceFhir) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpsertResource", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// UpsertResource indicates an expected call of UpsertResource. -func (mr *MockDatabaseRepositoryMockRecorder) UpsertResource(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpsertResource", reflect.TypeOf((*MockDatabaseRepository)(nil).UpsertResource), arg0, arg1) -} diff --git a/frontend/src/app/components/shared.module.ts b/frontend/src/app/components/shared.module.ts index 27c8ffbb..5ad5d505 100644 --- a/frontend/src/app/components/shared.module.ts +++ b/frontend/src/app/components/shared.module.ts @@ -33,6 +33,7 @@ import {ListGoalComponent} from './list-generic-resource/list-goal.component'; import { ListFallbackResourceComponent } from './list-fallback-resource/list-fallback-resource.component'; import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; import { ToastComponent } from './toast/toast.component'; +import { MomentModule } from 'ngx-moment'; @NgModule({ imports: [ @@ -40,6 +41,7 @@ import { ToastComponent } from './toast/toast.component'; BrowserModule, NgxDatatableModule, NgbModule, + MomentModule, ], declarations: [ ComponentsSidebarComponent, diff --git a/frontend/src/app/components/toast/toast.component.html b/frontend/src/app/components/toast/toast.component.html index d3b4e436..aefc4be0 100644 --- a/frontend/src/app/components/toast/toast.component.html +++ b/frontend/src/app/components/toast/toast.component.html @@ -8,7 +8,7 @@ >
{{toast.title}}
- 11 mins ago + {{toast.event_date | amTimeAgo}}
{{ toast.message }} diff --git a/frontend/src/app/models/fasten/toast.ts b/frontend/src/app/models/fasten/toast.ts index 5c1c2683..c6486851 100644 --- a/frontend/src/app/models/fasten/toast.ts +++ b/frontend/src/app/models/fasten/toast.ts @@ -5,6 +5,7 @@ export enum ToastType { } export class ToastNotification { + event_date: Date = new Date() title?: string message: string type: ToastType = ToastType.Info