Skip to content

Commit

Permalink
Merge pull request #55 from ConductionNL/feature/PC108-67/contactmome…
Browse files Browse the repository at this point in the history
…nten-api

feature/PC108-67/contactmomenten-api
  • Loading branch information
remko48 authored Nov 26, 2024
2 parents aa64b18 + fb07c6b commit e5c4146
Show file tree
Hide file tree
Showing 28 changed files with 2,572 additions and 93 deletions.
782 changes: 782 additions & 0 deletions src/data/countries.js

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions src/entities/contactmoment/contactmoment.mock.ts
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))
12 changes: 12 additions & 0 deletions src/entities/contactmoment/contactmoment.spec.ts
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)
})
})
44 changes: 44 additions & 0 deletions src/entities/contactmoment/contactmoment.ts
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)
}

}
11 changes: 11 additions & 0 deletions src/entities/contactmoment/contactmoment.types.ts
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;
}
3 changes: 3 additions & 0 deletions src/entities/contactmoment/index.js
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'
1 change: 1 addition & 0 deletions src/entities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './klanten/index.js'
export * from './taak/index.js'
export * from './bericht/index.js'
export * from './rol/index.js'
export * from './contactmoment/index.js'
8 changes: 8 additions & 0 deletions src/entities/klanten/klanten.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
28 changes: 28 additions & 0 deletions src/entities/klanten/klanten.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@ export class Klant implements TKlant {

public id: string
public type: TKlantType

public voornaam: string
public tussenvoegsel: string
public achternaam: string
public bsn: string
public geboortedatum: string
public land: string

public telefoonnummer: string
public emailadres: string

public straatnaam: string
public plaats: string
public postcode: string
public huisnummer: string

public functie: string
public aanmaakkanaal: string
public bronorganisatie: string
public bedrijfsnaam: string
public kvkNummer: string
public websiteUrl: string
public url: string
public geverifieerd: string
Expand All @@ -27,12 +39,20 @@ export class Klant implements TKlant {
this.voornaam = source.voornaam || ''
this.tussenvoegsel = source.tussenvoegsel || ''
this.achternaam = source.achternaam || ''
this.bsn = source.bsn || ''
this.geboortedatum = source.geboortedatum || ''
this.land = source.land || ''
this.telefoonnummer = source.telefoonnummer || ''
this.emailadres = source.emailadres || ''
this.straatnaam = source.straatnaam || ''
this.plaats = source.plaats || ''
this.postcode = source.postcode || ''
this.huisnummer = source.huisnummer || ''
this.functie = source.functie || ''
this.aanmaakkanaal = source.aanmaakkanaal || ''
this.bronorganisatie = source.bronorganisatie || ''
this.bedrijfsnaam = source.bedrijfsnaam || ''
this.kvkNummer = source.kvkNummer || ''
this.websiteUrl = source.websiteUrl || ''
this.url = source.url || ''
this.geverifieerd = source.geverifieerd || ''
Expand All @@ -47,12 +67,20 @@ export class Klant implements TKlant {
voornaam: z.string().min(1),
tussenvoegsel: z.string(),
achternaam: z.string(),
bsn: z.string(),
geboortedatum: z.string(),
land: z.string(),
telefoonnummer: z.string(),
emailadres: z.string().email(),
straatnaam: z.string(),
plaats: z.string(),
postcode: z.string(),
huisnummer: z.string(),
functie: z.string(),
aanmaakkanaal: z.string(),
bronorganisatie: z.string(),
bedrijfsnaam: z.string(),
kvkNummer: z.string(),
websiteUrl: z.string().url(),
url: z.string().url(),
geverifieerd: z.string(),
Expand Down
8 changes: 8 additions & 0 deletions src/entities/klanten/klanten.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ export type TKlant = {
voornaam: string;
tussenvoegsel: string;
achternaam: string;
bsn: string;
geboortedatum: string;
land: string;
telefoonnummer: string;
emailadres: string;
straatnaam: string;
plaats: string;
postcode: string;
huisnummer: string;
functie: string;
aanmaakkanaal: string;
bronorganisatie: string;
bedrijfsnaam: string;
kvkNummer: string;
websiteUrl: string;
url: string;
geverifieerd: string;
Expand Down
4 changes: 3 additions & 1 deletion src/modals/Modals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { navigationStore } from '../store/store.js'
<EditRol />
<ViewZaakAuditTrail v-if="navigationStore.modal === 'viewZaakAuditTrail'" />
<ViewKlantRegister v-if="navigationStore.modal === 'viewKlantRegister'" />
<DeleteContactMoment v-if="navigationStore.modal === 'deleteContactMoment'" />
</div>
</template>

Expand All @@ -35,7 +36,7 @@ import WidgetTaakForm from './taken/WidgetTaakForm.vue'
import EditRol from './rollen/EditRol.vue'
import ViewZaakAuditTrail from './zaken/ViewZaakAuditTrail.vue'
import ViewKlantRegister from './klantRegister/ViewKlantRegister.vue'
import DeleteContactMoment from './contactMomenten/DeleteContactMoment.vue'
export default {
name: 'Modals',
components: {
Expand All @@ -52,6 +53,7 @@ export default {
EditRol,
ViewZaakAuditTrail,
ViewKlantRegister,
DeleteContactMoment,
},
}
</script>
Loading

0 comments on commit e5c4146

Please sign in to comment.