mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-03-29 15:15:49 +00:00
tests for infractructure, domain entities and create authentication service
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { AggregateID, AggregateRoot } from '@mobicoop/ddd-library';
|
||||
import { UsernameProps } from './username.types';
|
||||
import { CreateUsernameProps, UsernameProps } from './username.types';
|
||||
import { UsernameAddedDomainEvent } from './events/username-added.domain-event';
|
||||
|
||||
export class UsernameEntity extends AggregateRoot<UsernameProps> {
|
||||
protected readonly _id: AggregateID;
|
||||
|
||||
static create = async (create: UsernameProps): Promise<UsernameEntity> => {
|
||||
static create = async (
|
||||
create: CreateUsernameProps,
|
||||
): Promise<UsernameEntity> => {
|
||||
const props: UsernameProps = { ...create };
|
||||
const username = new UsernameEntity({
|
||||
id: props.name,
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
// All properties that a Username has
|
||||
export interface UsernameProps {
|
||||
name: string;
|
||||
userId?: string;
|
||||
type: Type;
|
||||
}
|
||||
|
||||
export interface CreateUsernameProps {
|
||||
name: string;
|
||||
userId: string;
|
||||
type: Type;
|
||||
}
|
||||
|
||||
export enum Type {
|
||||
EMAIL = 'EMAIL',
|
||||
PHONE = 'PHONE',
|
||||
|
||||
Reference in New Issue
Block a user