-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/motion-forward
- Loading branch information
Showing
94 changed files
with
1,762 additions
and
693 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Id } from '../../definitions/key-types'; | ||
import { BaseModel } from '../base/base-model'; | ||
/** | ||
* Representation of a gender. | ||
* @ignore | ||
*/ | ||
|
||
export class Gender extends BaseModel<Gender> { | ||
public static COLLECTION = `gender`; | ||
|
||
public readonly name!: string; | ||
public organization_id!: Id; // (organization/gender_ids)[] | ||
public user_ids!: Id[]; // user/gender_id | ||
|
||
public constructor(input?: Partial<Gender>) { | ||
super(Gender.COLLECTION, input); | ||
} | ||
|
||
public static readonly REQUESTABLE_FIELDS: (keyof Gender)[] = [`id`, `name`, `organization_id`, `user_ids`]; | ||
} | ||
export interface Gender {} |
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
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
16 changes: 16 additions & 0 deletions
16
client/src/app/gateways/repositories/gender/gender-repository.service.spec.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,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { GenderRepositoryService } from './gender-repository.service'; | ||
|
||
xdescribe(`GenderRepositoryService`, () => { | ||
let service: GenderRepositoryService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(GenderRepositoryService); | ||
}); | ||
|
||
it(`should be created`, () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
49 changes: 49 additions & 0 deletions
49
client/src/app/gateways/repositories/gender/gender-repository.service.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,49 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Id } from 'src/app/domain/definitions/key-types'; | ||
import { Identifiable } from 'src/app/domain/interfaces'; | ||
import { Gender } from 'src/app/domain/models/gender/gender'; | ||
import { BaseRepository } from 'src/app/gateways/repositories/base-repository'; | ||
import { ViewGender } from 'src/app/site/pages/organization/pages/accounts/pages/gender/view-models/view-gender'; | ||
import { Fieldsets } from 'src/app/site/services/model-request-builder'; | ||
|
||
import { Action } from '../../actions'; | ||
import { RepositoryServiceCollectorService } from '../repository-service-collector.service'; | ||
import { GenderAction } from './gender.action'; | ||
|
||
@Injectable({ | ||
providedIn: `root` | ||
}) | ||
export class GenderRepositoryService extends BaseRepository<ViewGender, Gender> { | ||
public constructor(repositoryServiceCollector: RepositoryServiceCollectorService) { | ||
super(repositoryServiceCollector, Gender); | ||
} | ||
|
||
public getVerboseName = (plural?: boolean): string => (plural ? `Genders` : `Gender`); | ||
public getTitle = (viewModel: ViewGender): string => viewModel.name; | ||
public override getFieldsets(): Fieldsets<any> { | ||
const baseFields: (keyof Gender)[] = []; | ||
const requiredFields: (keyof Gender)[] = baseFields.concat([`name`]); | ||
return { | ||
...super.getFieldsets(), | ||
required: requiredFields | ||
}; | ||
} | ||
|
||
public create(...genders: any[]): Action<Identifiable[]> { | ||
const payload = genders; | ||
return this.createAction(GenderAction.CREATE, payload); | ||
} | ||
|
||
public update(update: any, id: Id): Action<void> { | ||
const payload = { | ||
id, | ||
...update | ||
}; | ||
return this.createAction(GenderAction.UPDATE, payload); | ||
} | ||
|
||
public delete(...ids: Id[]): Action<void> { | ||
const payload = ids.map(id => ({ id })); | ||
return this.createAction(GenderAction.DELETE, payload); | ||
} | ||
} |
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 @@ | ||
export class GenderAction { | ||
public static readonly CREATE = `gender.create`; | ||
public static readonly UPDATE = `gender.update`; | ||
public static readonly DELETE = `gender.delete`; | ||
} |
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
Oops, something went wrong.