-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from ConductionNL/feature/PC108-67/contactmome…
…nten-api feature/PC108-67/contactmomenten-api
- Loading branch information
Showing
28 changed files
with
2,572 additions
and
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ContactMoment } from './contactmoment' | ||
import { TContactMoment } from './contactmoment.types' | ||
|
||
export const mockContactMomentData = (): TContactMoment[] => [ | ||
{ | ||
id: '15551d6f-44e3-43f3-a9d2-59e583c91eb0', | ||
uuid: '15551d6f-44e3-43f3-a9d2-59e583c91eb0', | ||
titel: 'Zaak 3', | ||
notitie: 'Zaak 3', | ||
klant: 'Klant 3', | ||
zaak: 'Zaak 3', | ||
taak: 'Taak 3', | ||
product: 'Product 3', | ||
startDate: new Date().toISOString(), | ||
}, | ||
] | ||
|
||
export const mockContactMoment = (data: TContactMoment[] = mockContactMomentData()): TContactMoment[] => data.map(item => new ContactMoment(item)) |
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,12 @@ | ||
import { ContactMoment } from './contactmoment' | ||
import { mockContactMomentData } from './contactmoment.mock' | ||
|
||
describe('ContactMoment Entity', () => { | ||
it('should create a ContactMoment entity with full data', () => { | ||
const contactMoment = new ContactMoment(mockContactMomentData()[0]) | ||
|
||
expect(contactMoment).toBeInstanceOf(ContactMoment) | ||
expect(contactMoment).toEqual(mockContactMomentData()[0]) | ||
expect(contactMoment.validate().success).toBe(true) | ||
}) | ||
}) |
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,44 @@ | ||
import { SafeParseReturnType, z } from 'zod' | ||
import { TContactMoment } from './contactmoment.types' | ||
|
||
export class ContactMoment implements TContactMoment { | ||
|
||
public id: string | ||
public uuid: string | ||
public titel: string | ||
public notitie: string | ||
public klant: string | ||
public zaak: string | ||
public taak: string | ||
public product: string | ||
public startDate: string | ||
|
||
constructor(source: TContactMoment) { | ||
this.id = source.id || '' | ||
this.uuid = source.uuid || '' | ||
this.titel = source.titel || '' | ||
this.notitie = source.notitie || '' | ||
this.klant = source.klant || '' | ||
this.zaak = source.zaak || '' | ||
this.taak = source.taak || '' | ||
this.product = source.product || '' | ||
this.startDate = source.startDate || '' | ||
} | ||
|
||
public validate(): SafeParseReturnType<TContactMoment, unknown> { | ||
const schema = z.object({ | ||
id: z.string().optional(), | ||
uuid: z.string().optional(), | ||
titel: z.string().min(1), | ||
notitie: z.string().min(1), | ||
klant: z.string().min(1), | ||
zaak: z.string().min(1), | ||
taak: z.string().min(1), | ||
product: z.string().min(1), | ||
startDate: z.string().min(1), | ||
}) | ||
|
||
return schema.safeParse(this) | ||
} | ||
|
||
} |
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,11 @@ | ||
export type TContactMoment = { | ||
id: string; | ||
uuid: string; | ||
titel: string; | ||
notitie: string; | ||
klant: string; | ||
zaak: string; | ||
taak: string; | ||
product: string; | ||
startDate: string; | ||
} |
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,3 @@ | ||
export * from './contactmoment.ts' | ||
export * from './contactmoment.types.ts' | ||
export * from './contactmoment.mock.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
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 |
---|---|---|
|
@@ -8,11 +8,19 @@ export const mockKlantData = (): TKlant[] => [ | |
voornaam: 'John', | ||
tussenvoegsel: 'de', | ||
achternaam: 'Doe', | ||
bsn: '1234567890', | ||
geboortedatum: '1990-01-01', | ||
land: 'Nederland', | ||
telefoonnummer: '0612345678', | ||
emailadres: '[email protected]', | ||
straatnaam: 'Example Street', | ||
plaats: 'Example City', | ||
postcode: '1234AB', | ||
huisnummer: '123', | ||
functie: 'Software Developer', | ||
aanmaakkanaal: 'email', | ||
bronorganisatie: 'Example Corp', | ||
kvkNummer: '1234567890', | ||
bedrijfsnaam: 'Example Corp', | ||
websiteUrl: 'http://example.com', | ||
url: 'http://example.com', | ||
|
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
Oops, something went wrong.