Skip to content

Commit

Permalink
Merge pull request #54 from ConductionNL/development
Browse files Browse the repository at this point in the history
Development to main
  • Loading branch information
remko48 authored Nov 25, 2024
2 parents 05b00a9 + c527e26 commit 26815b8
Show file tree
Hide file tree
Showing 24 changed files with 1,408 additions and 17 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pull-request-from-branch-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Main Branch Protection

on:
pull_request:
branches:
- master

jobs:
check-branch:
runs-on: ubuntu-latest
steps:
- name: Check branch
run: |
if [[ ${GITHUB_HEAD_REF} != development ]] && [[ ${GITHUB_HEAD_REF} != documentation ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]];
then
echo "Error: Pull request must come from 'development', 'documentation' or 'hotfix/' branch"
exit 1
fi
20 changes: 20 additions & 0 deletions .github/workflows/pull-request-lint-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint Check

on:
pull_request:
branches:
- never

jobs:
lint-check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: npm i

- name: Linting
run: npm run lint
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'taken' => ['url' => 'api/taken'],
'klanten' => ['url' => 'api/klanten'],
'berichten' => ['url' => 'api/berichten'],
'contactmomenten' => ['url' => 'api/contactmomenten'],

],
'routes' => [
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
"bamarni/composer-bin-plugin": "^1.8",
"elasticsearch/elasticsearch": "^v8.14.0",
"guzzlehttp/guzzle": "^7.0",
"symfony/uid": "^6.4"
"symfony/uid": "^6.4",
"symfony/yaml": "^6.4"

},
"require-dev": {
"nextcloud/ocp": "dev-stable29",
Expand Down
134 changes: 134 additions & 0 deletions lib/Controller/ContactMomentenController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?php

namespace OCA\ZaakAfhandelApp\Controller;

use OCA\ZaakAfhandelApp\Service\ObjectService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;

/**
* Controller for handling contact moments (contactmomenten) operations
*/
class ContactMomentenController extends Controller
{
public function __construct(
$appName,
IRequest $request,
private readonly ObjectService $objectService,
)
{
parent::__construct($appName, $request);
}

/**
* Return (and search) all contact moments
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function index(): JSONResponse
{
// Retrieve all request parameters
$requestParams = $this->request->getParams();

// Fetch contact moments based on filters and order
$data = $this->objectService->getResultArrayForRequest('contactmomenten', $requestParams);

// Return JSON response
return new JSONResponse($data);
}

/**
* Read a single contact moment
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function show(string $id): JSONResponse
{
// Fetch the contact moment by its ID
$object = $this->objectService->getObject('contactmomenten', $id);

// Return the contact moment as a JSON response
return new JSONResponse($object);
}

/**
* Create a contact moment
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function create(): JSONResponse
{
// Get all parameters from the request
$data = $this->request->getParams();

// Remove the 'id' field if it exists, as we're creating a new contact moment
unset($data['id']);

// Save the new contact moment
$object = $this->objectService->saveObject('contactmomenten', $data);

// Return the created contact moment as a JSON response
return new JSONResponse($object);
}

/**
* Update a contact moment
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function update(string $id): JSONResponse
{
// Get all parameters from the request
$data = $this->request->getParams();

// Save the updated contact moment
$object = $this->objectService->saveObject('contactmomenten', $data);

// Return the updated contact moment as a JSON response
return new JSONResponse($object);
}

/**
* Delete a contact moment
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function destroy(string $id): JSONResponse
{
// Delete the contact moment
$result = $this->objectService->deleteObject('contactmomenten', $id);

// Return the result as a JSON response
return new JSONResponse(['success' => $result], $result === true ? '200' : '404');
}

/**
* Get audit trail for a specific contact moment
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return JSONResponse
*/
public function getAuditTrail(string $id): JSONResponse
{
$auditTrail = $this->objectService->getAuditTrail('contactmomenten', $id);
return new JSONResponse($auditTrail);
}
}
4 changes: 4 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "zaakafhandelapp",
"version": "1.0.0",
"license": "AGPL-3.0-or-later",
"engines": {
"node": "^20.0.0",
"npm": "^10.0.0"
},
"scripts": {
"build": "NODE_ENV=production webpack --config webpack.config.js --progress",
"dev": "NODE_ENV=development webpack --config webpack.config.js --progress",
Expand Down
1 change: 1 addition & 0 deletions src/entities/zaak/zaak.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const mockZaakData = (): TZaak[] => [
laatsteBetaaldatum: '2019-08-24T14:15:22Z',
selectielijstklasse: 'http://example.com',
hoofdzaak: 'http://example.com',
klant: '15551d6f-44e3-43f3-a9d2-59e583c91eb0',
},
]

Expand Down
3 changes: 3 additions & 0 deletions src/entities/zaak/zaak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class Zaak implements TZaak {
public laatsteBetaaldatum: string
public selectielijstklasse: string
public hoofdzaak: string
public klant: string

constructor(source: TZaak) {
this.id = source.id || ''
Expand All @@ -49,6 +50,7 @@ export class Zaak implements TZaak {
this.laatsteBetaaldatum = source.laatsteBetaaldatum || ''
this.selectielijstklasse = source.selectielijstklasse || ''
this.hoofdzaak = source.hoofdzaak || ''
this.klant = source.klant || ''
}

public validate(): SafeParseReturnType<TZaak, unknown> {
Expand All @@ -75,6 +77,7 @@ export class Zaak implements TZaak {
laatsteBetaaldatum: z.string(),
selectielijstklasse: z.string(),
hoofdzaak: z.string(),
klant: z.string(),
})

return schema.safeParse(this)
Expand Down
1 change: 1 addition & 0 deletions src/entities/zaak/zaak.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export type TZaak = {
laatsteBetaaldatum: string;
selectielijstklasse: string;
hoofdzaak: string;
klant: string;
}
9 changes: 9 additions & 0 deletions src/modals/Modals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,52 @@ import { navigationStore } from '../store/store.js'
<!-- Placeholder -->
<div>
<ZaakForm v-if="navigationStore.modal === 'zaakForm'" />
<WidgetZaakForm v-if="navigationStore.modal === 'widgetZaakForm'" />
<EditZaakType />
<EditKlant />
<ViewKlantAuditTrail v-if="navigationStore.modal === 'viewKlantAuditTrail'" />
<EditBericht />
<ViewBerichtAuditTrail v-if="navigationStore.modal === 'viewBerichtAuditTrail'" />
<EditTaak />
<WidgetTaakForm v-if="navigationStore.modal === 'widgetTaakForm'" />
<ViewTaakAuditTrail v-if="navigationStore.modal === 'viewTaakAuditTrail'" />
<EditRol />
<ViewZaakAuditTrail v-if="navigationStore.modal === 'viewZaakAuditTrail'" />
<ViewKlantRegister v-if="navigationStore.modal === 'viewKlantRegister'" />
</div>
</template>

<script>
import ZaakForm from './zaken/ZaakForm.vue'
import WidgetZaakForm from './zaken/WidgetZaakForm.vue'
import EditZaakType from './zaakTypen/EditZaakType.vue'
import EditKlant from './klanten/EditKlant.vue'
import ViewKlantAuditTrail from './klanten/ViewKlantAuditTrail.vue'
import EditBericht from './berichten/EditBericht.vue'
import ViewBerichtAuditTrail from './berichten/ViewBerichtAuditTrail.vue'
import EditTaak from './taken/EditTaak.vue'
import ViewTaakAuditTrail from './taken/ViewTaakAuditTrail.vue'
import WidgetTaakForm from './taken/WidgetTaakForm.vue'
import EditRol from './rollen/EditRol.vue'
import ViewZaakAuditTrail from './zaken/ViewZaakAuditTrail.vue'
import ViewKlantRegister from './klantRegister/ViewKlantRegister.vue'
export default {
name: 'Modals',
components: {
ZaakForm,
WidgetZaakForm,
EditZaakType,
EditKlant,
ViewKlantAuditTrail,
EditBericht,
ViewBerichtAuditTrail,
EditTaak,
WidgetTaakForm,
ViewTaakAuditTrail,
EditRol,
ViewZaakAuditTrail,
ViewKlantRegister,
},
}
</script>
2 changes: 2 additions & 0 deletions src/modals/berichten/EditBericht.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ export default {
gebruikerID: '',
volgorde: '',
}
this.$emit('close-modal')
},
async editBericht() {
this.loading = true
Expand Down
Loading

0 comments on commit 26815b8

Please sign in to comment.