@burgan-tech/morph-touch-runtime 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,14 +23,34 @@ public class GetRezervationsMapping : ScriptBase, IMapping
23
23
  var appId = GetConfigValue("DAPR_APP_ID");
24
24
  if (!string.IsNullOrEmpty(appId))
25
25
  serviceTask.SetAppId(appId);
26
+ var headers = (Dictionary<string, string>)context.Headers;
27
+ var advisorId = string.Empty;
28
+ var userId = string.Empty;
29
+ var managerId = string.Empty;
30
+ var touchUser = headers.ContainsKey("touchUser") ? headers["touchUser"] : string.Empty;
31
+ var userType = headers.ContainsKey("userType") ? headers["userType"] : string.Empty;
32
+ if (string.IsNullOrWhiteSpace(touchUser) || string.IsNullOrWhiteSpace(userType))
33
+ throw new InvalidOperationException("Headers 'touchUser' and 'userType' are both required.");
34
+
35
+ if (string.Equals(userType, "customer", StringComparison.OrdinalIgnoreCase))
36
+ userId = touchUser;
37
+ else if (string.Equals(userType, "manager", StringComparison.OrdinalIgnoreCase))
38
+ managerId = touchUser;
39
+ else if (string.Equals(userType, "advisor", StringComparison.OrdinalIgnoreCase))
40
+ advisorId = touchUser;
41
+ else if (string.Equals(userType, "admin", StringComparison.OrdinalIgnoreCase))
42
+ {
26
43
 
27
- // Read parameters from query string (GET request)
28
- var advisorId = context.QueryParameters != null && HasProperty(context.QueryParameters, "advisorId") ? context.QueryParameters?["advisorId"]?.ToString() : string.Empty;
29
- var userId = context.QueryParameters != null && HasProperty(context.QueryParameters, "userId") ? context.QueryParameters?["userId"]?.ToString() : string.Empty;
30
- var managerId = context.QueryParameters != null && HasProperty(context.QueryParameters, "managerId") ? context.QueryParameters?["managerId"]?.ToString() : string.Empty;
31
- var startDate = context.QueryParameters != null && HasProperty(context.QueryParameters, "startDate") ? context.QueryParameters?["startDate"]?.ToString() : string.Empty;
32
- var endDate = context.QueryParameters != null && HasProperty(context.QueryParameters, "endDate") ? context.QueryParameters?["endDate"]?.ToString() : string.Empty;
33
-
44
+ }
45
+ else
46
+ {
47
+ throw new InvalidOperationException("Invalid user type: " + userType);
48
+ }
49
+ // admin: touchUser is always sent; no user/manager/advisor scope filter on the query
50
+ ;
51
+ // admin: touchUser is always sent; no user/manager/advisor scope filter on the query
52
+ var startDate =headers.ContainsKey("startDate")? headers["startDate"] : string.Empty;
53
+ var endDate =headers.ContainsKey("endDate")? headers["endDate"] : string.Empty;
34
54
  // Build filter conditions
35
55
  var conditions = new List<string>();
36
56
 
@@ -1,6 +1,6 @@
1
1
  # Morph-touch domain — technical overview
2
2
 
3
- This document summarizes appointment (rezervation), absence, chat room, notification, and transfer flows in the `morph-touch` domain, based on workflow definitions and task mapping behaviour. API examples align with the [postman_collection.json](../../postman_collection.json) collection.
3
+ This document summarizes appointment (rezervation), absence, chat room, notification, and transfer flows in the `morph-touch` domain, based on workflow definitions and task mapping behaviour. HTTP examples use the **`{{BaseUrl}}/morph-touch/...`** template; the [postman_collection.json](../../postman_collection.json) collection may still use variables such as `api/v{{apiVersion}}` — align `baseUrl` and path prefixes with your gateway.
4
4
 
5
5
  Turkish version: [morph-touch-domain.md](morph-touch-domain.md).
6
6
 
@@ -9,7 +9,7 @@ Turkish version: [morph-touch-domain.md](morph-touch-domain.md).
9
9
  ## 1. Overview and terminology
10
10
 
11
11
  - **Domain:** `morph-touch`
12
- - **Workflow instance:** vNext instance model with `key`, `flow` (`sys-flows`), `domain`, and `version`; started over HTTP at `.../workflows/{flowKey}/instances/...`, transitions at `.../transitions/{transitionKey}`.
12
+ - **Workflow instance:** vNext instance model with `key`, `flow` (`sys-flows`), `domain`, and `version`; started over HTTP at `.../workflows/{flowKey}/instances/...`, transitions at `.../transitions/{transitionKey}`. After `instances/`, the path may use the platform **instance id** (UUID) or the instance **`key`** from the `start` request.
13
13
  - **Integrations:**
14
14
  - **DAPR / application API:** `api/v{version}/{domain}/...` (paths such as `functions/state`, `functions/data` in mappings).
15
15
  - **Matrix:** `MatrixBaseUrl` (secret); room creation, join, invite, kick, history visibility.
@@ -63,6 +63,8 @@ flowchart LR
63
63
 
64
64
  Records are usually kept in `complete`; updated via `update`, moved to `cancelled` via `cancel`.
65
65
 
66
+ For detailed request bodies, key rules, and cURL examples, see **section 14**.
67
+
66
68
  ### Link to appointment transfer
67
69
 
68
70
  - Transition **`start-transfer`** is evaluated only when `absenceType == "personal-leave"` (`CanStartTransferMapping` — [Workflows/src/CanStartTransferMapping.csx](../Workflows/src/CanStartTransferMapping.csx)).
@@ -276,13 +278,14 @@ See [Functions/get-room-messages.http](../Functions/get-room-messages.http) for
276
278
  ### Workflow API templates
277
279
 
278
280
  - **Start instance:**
279
- `POST {{baseUrl}}/api/v{{apiVersion}}/{{domain}}/workflows/{flowKey}/instances/start?sync=true`
281
+ `POST {{baseUrl}}/morph-touch/workflows/{flowKey}/instances/start?sync=true`
280
282
  Examples: `rezervation`, `absence-entry`, `rezervation-start`, `chat-room`, `start-chat`, `rezervation-transfer`, `notification-sender` (subflow).
281
283
  - **Get instance:**
282
- `GET .../workflows/{flowKey}/instances/{{instanceId}}`
284
+ `GET {{baseUrl}}/morph-touch/workflows/{flowKey}/instances/{{instanceIdOrKey}}`
285
+ Path segment: platform **instance `id`** (UUID) or the instance **`key`** from the `start` request (e.g. `working-hour`, `rez-...`).
283
286
  - **Transition:**
284
- `PATCH .../workflows/{flowKey}/instances/{{instanceId}}/transitions/{transitionKey}?sync=true`
285
- Body is usually `{ "attributes": { ... } }`.
287
+ `PATCH {{baseUrl}}/morph-touch/workflows/{flowKey}/instances/{{instanceIdOrKey}}/transitions/{transitionKey}?sync=true`
288
+ Same: **id** or **`key`**. Body is usually `{ "attributes": { ... } }`.
286
289
 
287
290
  ### Sample requests (collection folders)
288
291
 
@@ -325,4 +328,415 @@ Collection descriptions reference [vNext documentation](https://github.com/burga
325
328
 
326
329
  ---
327
330
 
331
+ ## 14. API usage guide (cURL and field rules)
332
+
333
+ ### 14.1 Prerequisite order
334
+
335
+ For appointments and **get-available-slots**, define **company working hours** first (`absenceType: working-hours-change`, instance `key: "working-hour"`, tags `working-hours-change` + `company`). Then use public holidays, advisor leave / custom hours, and the reservation flow.
336
+
337
+ ### 14.2 `{{BaseUrl}}`, path template, and authentication
338
+
339
+ - In all examples, **`{{BaseUrl}}`** is your API gateway **root** (e.g. `https://<host>` or `https://<host>/ebanking` depending on deployment). Set it per APISIX / environment docs; avoid a trailing slash on the root or you may get **double slashes** (`//morph-touch`) when concatenating.
340
+ - Standard template: **`{{BaseUrl}}/morph-touch/workflows/...`** and **`{{BaseUrl}}/morph-touch/functions/...`** (e.g. `{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true`).
341
+ - This matches the role of Postman’s `{{baseUrl}}`; this doc uses the name **`{{BaseUrl}}`**.
342
+ - **`Authorization: Bearer <access_token>`:** The access token is **environment-specific** (dev, test, production). Obtain it from your identity provider or whatever process your environment documents (APISIX, API portal, security team). `<access_token>` in examples is only a placeholder; never commit real tokens to the repo or shared docs.
343
+ - In `.../workflows/{flowKey}/instances/<segment>/...`, `<segment>` is **`{{instanceIdOrKey}}`**: either the platform **instance id** or the instance **`key`**.
344
+
345
+ ### 14.3 Company working hours — `absence-entry` start (once)
346
+
347
+ `key` must be **`working-hour`**. `absenceType` is **`working-hours-change`**. Under `customWorkingHours`, weekdays (`monday` … `sunday`) are arrays of `{ "start": "HH:mm", "end": "HH:mm" }`.
348
+
349
+ ```bash
350
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
351
+ --header 'Content-Type: application/json' \
352
+ --header 'Accept-Language: tr-TR' \
353
+ --header 'X-Request-Id: <uuid>' \
354
+ --header 'Authorization: Bearer <access_token>' \
355
+ --data '{
356
+ "key": "working-hour",
357
+ "tags": ["working-hours-change", "company"],
358
+ "attributes": {
359
+ "absenceType": "working-hours-change",
360
+ "title": "Company working hours",
361
+ "customWorkingHours": {
362
+ "monday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
363
+ "tuesday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
364
+ "wednesday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
365
+ "thursday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
366
+ "friday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "17:00"}],
367
+ "saturday": [],
368
+ "sunday": []
369
+ }
370
+ }
371
+ }'
372
+ ```
373
+
374
+ ### 14.4 Company working hours — later updates (`update`)
375
+
376
+ Usually **one** `start` for company-wide record; afterwards use only **`PATCH .../transitions/update`**. In the URL, **`{{instanceIdOrKey}}`** may be the **platform instance id** (UUID) from the response or the fixed company **`key`** (`working-hour`).
377
+
378
+ ```bash
379
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/{{instanceIdOrKey}}/transitions/update?sync=true' \
380
+ --header 'Content-Type: application/json' \
381
+ --header 'Accept-Language: tr-TR' \
382
+ --header 'X-Request-Id: <uuid>' \
383
+ --header 'Authorization: Bearer <access_token>' \
384
+ --data '{
385
+ "attributes": {
386
+ "title": "Company working hours (updated)",
387
+ "customWorkingHours": {
388
+ "monday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
389
+ "tuesday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
390
+ "wednesday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
391
+ "thursday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
392
+ "friday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "16:30"}],
393
+ "saturday": [],
394
+ "sunday": []
395
+ }
396
+ }
397
+ }'
398
+ ```
399
+
400
+ ### 14.5 Public holiday (`public-holiday`)
401
+
402
+ Key pattern: `public-holiday-{date}`. `absenceType` **`public-holiday`**. Set `startDateTime` / `endDateTime` for full or half day.
403
+
404
+ ```bash
405
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
406
+ --header 'Content-Type: application/json' \
407
+ --header 'Accept-Language: tr-TR' \
408
+ --header 'X-Request-Id: <uuid>' \
409
+ --header 'Authorization: Bearer <access_token>' \
410
+ --data '{
411
+ "key": "public-holiday-2026-04-23",
412
+ "tags": ["public-holiday"],
413
+ "attributes": {
414
+ "absenceType": "public-holiday",
415
+ "startDateTime": "2026-04-23T00:00:00",
416
+ "endDateTime": "2026-04-23T23:59:59",
417
+ "title": "National Sovereignty and Children's Day"
418
+ }
419
+ }'
420
+ ```
421
+
422
+ ### 14.6 Personal leave (`personal-leave`)
423
+
424
+ Key pattern: `personal-leave-{advisorId}-{startDateTime}-{endDateTime}`. `absenceType` **`personal-leave`**. `advisor` is the advisor unique id (often employee id). `advisorType` may be short (**`PM` / `IA`**) or full workflow values (**`portfolio-manager` / `investment-advisor`**) per your contract.
425
+
426
+ ```bash
427
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
428
+ --header 'Content-Type: application/json' \
429
+ --header 'Accept-Language: tr-TR' \
430
+ --header 'X-Request-Id: <uuid>' \
431
+ --header 'sub: <user_sub>' \
432
+ --header 'Authorization: Bearer <access_token>' \
433
+ --data '{
434
+ "key": "personal-leave-<advisorId>-2026-04-07T00:00:00-2026-04-07T12:59:59",
435
+ "tags": ["personal-leave"],
436
+ "attributes": {
437
+ "advisor": "<advisorId>",
438
+ "advisorType": "PM",
439
+ "absenceType": "personal-leave",
440
+ "startDateTime": "2026-04-07T00:00:00",
441
+ "endDateTime": "2026-04-07T12:59:59",
442
+ "title": "Customer meeting"
443
+ }
444
+ }'
445
+ ```
446
+
447
+ ### 14.7 Advisor-specific working hours (`working-hours-change` + advisor)
448
+
449
+ Key pattern: `working-hour-{advisorId}`. Tags: `working-hours-change`, `advisor`. `advisor` required; `customWorkingHours` same shape as §14.3.
450
+
451
+ ```bash
452
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
453
+ --header 'Content-Type: application/json' \
454
+ --header 'Accept-Language: tr-TR' \
455
+ --header 'X-Request-Id: <uuid>' \
456
+ --header 'Authorization: Bearer <access_token>' \
457
+ --data '{
458
+ "key": "working-hour-<advisorId>",
459
+ "tags": ["working-hours-change", "advisor"],
460
+ "attributes": {
461
+ "advisor": "<advisorId>",
462
+ "absenceType": "working-hours-change",
463
+ "title": "Advisor custom hours",
464
+ "customWorkingHours": {
465
+ "monday": [{"start": "10:00", "end": "12:00"}, {"start": "13:00", "end": "19:00"}],
466
+ "tuesday": [],
467
+ "wednesday": [],
468
+ "thursday": [],
469
+ "friday": [],
470
+ "saturday": [],
471
+ "sunday": []
472
+ }
473
+ }
474
+ }'
475
+ ```
476
+
477
+ ### 14.8 Cancel — `cancel` transition
478
+
479
+ ```bash
480
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/{{instanceIdOrKey}}/transitions/cancel?sync=true' \
481
+ --header 'Content-Type: application/json' \
482
+ --header 'Accept-Language: tr-TR' \
483
+ --header 'X-Request-Id: <uuid>' \
484
+ --header 'Authorization: Bearer <access_token>' \
485
+ --data '{"attributes": {}}'
486
+ ```
487
+
488
+ ### 14.9 Absence update — `update` (example: leave times)
489
+
490
+ ```bash
491
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/{{instanceIdOrKey}}/transitions/update?sync=true' \
492
+ --header 'Content-Type: application/json' \
493
+ --header 'Accept-Language: tr-TR' \
494
+ --header 'X-Request-Id: <uuid>' \
495
+ --header 'Authorization: Bearer <access_token>' \
496
+ --data '{
497
+ "attributes": {
498
+ "startDateTime": "2026-01-28T15:00:00",
499
+ "endDateTime": "2026-01-28T17:00:00",
500
+ "title": "Customer meeting (updated)"
501
+ }
502
+ }'
503
+ ```
504
+
505
+ ### 14.10 `get-absence-entry` function
506
+
507
+ Required `absenceType`. Company-only: `working-hours-change` alone. Date range for public holidays; `advisor` for advisor working hours.
508
+
509
+ ```bash
510
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-absence-entry?absenceType=working-hours-change' \
511
+ --header 'Accept: application/json' \
512
+ --header 'Accept-Language: tr-TR' \
513
+ --header 'X-Request-Id: <uuid>' \
514
+ --header 'Authorization: Bearer <access_token>'
515
+
516
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-absence-entry?absenceType=public-holiday&startDate=2026-04-01T00:00:00&endDate=2026-04-30T23:59:59' \
517
+ --header 'Accept: application/json' \
518
+ --header 'Accept-Language: tr-TR' \
519
+ --header 'X-Request-Id: <uuid>' \
520
+ --header 'Authorization: Bearer <access_token>'
521
+
522
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-absence-entry?absenceType=working-hours-change&advisor=<advisorId>' \
523
+ --header 'Accept: application/json' \
524
+ --header 'Accept-Language: tr-TR' \
525
+ --header 'X-Request-Id: <uuid>' \
526
+ --header 'Authorization: Bearer <access_token>'
527
+ ```
528
+
529
+ ### 14.11 `get-available-slots`
530
+
531
+ Returns free slots for `advisorId` on `date`; optional `duration` (minutes).
532
+
533
+ ```bash
534
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-available-slots?advisorId=<advisorId>&date=2026-03-17' \
535
+ --header 'Accept: application/json' \
536
+ --header 'Accept-Language: tr-TR' \
537
+ --header 'X-Request-Id: <uuid>' \
538
+ --header 'Authorization: Bearer <access_token>'
539
+ ```
540
+
541
+ Example body:
542
+
543
+ ```json
544
+ {
545
+ "getAvailableSlots": {
546
+ "availableSlots": [
547
+ "09:00-09:30",
548
+ "09:30-10:00",
549
+ "10:00-10:30"
550
+ ]
551
+ }
552
+ }
553
+ ```
554
+
555
+ ### 14.12 Reservation flow (`rezervation`)
556
+
557
+ 1. **`start`:** `key` must be unique per reservation; reuse as `randevuKey`. Align `startDateTime` / `endDateTime` with slots. Send **`sub`** (customer identity).
558
+ 2. Past date or duplicate active reservation rules may reject creation (see §4 / §12).
559
+ 3. If state is **`slot-unavailable`**, call **`appointment-form-retry`** with new times.
560
+ 4. After **`appointment-form`**, **`confirm-selection`** confirms user input.
561
+ 5. **`create-appointment`** moves to **`active`**; notifications and `get-user-info-for-rezervation` run; SMS to registered phone.
562
+
563
+ In the transition URLs below, use either the **platform instance id** or the reservation **`key`** from `start` (e.g. `rez-<unique-suffix>`) as `{{rezervationInstanceIdOrKey}}`.
564
+
565
+ ```bash
566
+ curl --location '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/start?sync=true' \
567
+ --header 'Content-Type: application/json' \
568
+ --header 'Accept-Language: tr-TR' \
569
+ --header 'X-Request-Id: <uuid>' \
570
+ --header 'sub: <customer_sub>' \
571
+ --header 'Authorization: Bearer <access_token>' \
572
+ --data '{
573
+ "key": "rez-<unique-suffix>",
574
+ "tags": ["appointment", "randevu"],
575
+ "attributes": {
576
+ "user": "<userRef>",
577
+ "advisor": "<advisorRef>",
578
+ "startDateTime": "2026-04-17T10:30:00",
579
+ "endDateTime": "2026-04-17T11:00:00"
580
+ }
581
+ }'
582
+ ```
583
+
584
+ ```bash
585
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/{{rezervationInstanceIdOrKey}}/transitions/appointment-form-retry?sync=true' \
586
+ --header 'Content-Type: application/json' \
587
+ --header 'Accept-Language: tr-TR' \
588
+ --header 'X-Request-Id: <uuid>' \
589
+ --header 'Authorization: Bearer <access_token>' \
590
+ --data '{
591
+ "attributes": {
592
+ "startDateTime": "2026-04-17T11:00:00",
593
+ "endDateTime": "2026-04-17T11:30:00"
594
+ }
595
+ }'
596
+ ```
597
+
598
+ ```bash
599
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/{{rezervationInstanceIdOrKey}}/transitions/confirm-selection?sync=true' \
600
+ --header 'Content-Type: application/json' \
601
+ --header 'Accept-Language: tr-TR' \
602
+ --header 'X-Request-Id: <uuid>' \
603
+ --header 'Authorization: Bearer <access_token>' \
604
+ --data '{"attributes": {}}'
605
+ ```
606
+
607
+ ```bash
608
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/{{rezervationInstanceIdOrKey}}/transitions/create-appointment?sync=true' \
609
+ --header 'Content-Type: application/json' \
610
+ --header 'Accept-Language: tr-TR' \
611
+ --header 'X-Request-Id: <uuid>' \
612
+ --header 'Authorization: Bearer <access_token>' \
613
+ --data '{"attributes": {}}'
614
+ ```
615
+
616
+ ### 14.13 Start meeting (`rezervation-start`)
617
+
618
+ Callable up to **15 minutes** before start; earlier yields **`meet-not-started`**. `randevuKey` is the reservation `key`. `participantType`: `customer`, `advisor`, or `invited`. For **`invited`**, send **`invitedUserId`** and add the user via **add-participant-to-rezervation** first. First participant creates the Matrix room and moves reservation to **`in-meet`**; second joins.
619
+
620
+ ```bash
621
+ curl --location '{{BaseUrl}}/morph-touch/workflows/rezervation-start/instances/start?sync=true' \
622
+ --header 'Content-Type: application/json' \
623
+ --header 'Accept-Language: tr-TR' \
624
+ --header 'X-Request-Id: <uuid>' \
625
+ --header 'Authorization: Bearer <access_token>' \
626
+ --data '{
627
+ "key": "randevu-<unique-suffix>",
628
+ "tags": ["randevu", "meeting"],
629
+ "attributes": {
630
+ "randevuKey": "rez-<unique-suffix>",
631
+ "participantType": "advisor"
632
+ }
633
+ }'
634
+ ```
635
+
636
+ For invited: set `participantType: "invited"` and `invitedUserId: "<inviteeId>"`.
637
+
638
+ ### 14.14 Add participant (`add-participant-to-rezervation`)
639
+
640
+ ```bash
641
+ curl --location '{{BaseUrl}}/morph-touch/workflows/add-participant-to-rezervation/instances/start?sync=true' \
642
+ --header 'Content-Type: application/json' \
643
+ --header 'Accept-Language: tr-TR' \
644
+ --header 'X-Request-Id: <uuid>' \
645
+ --header 'Authorization: Bearer <access_token>' \
646
+ --data '{
647
+ "key": "add-participant-<unique-suffix>",
648
+ "tags": ["rezervation", "add-participant"],
649
+ "attributes": {
650
+ "randevuKey": "rez-<unique-suffix>",
651
+ "newUserId": "<inviteeEmployeeId>"
652
+ }
653
+ }'
654
+ ```
655
+
656
+ Suggested `key` pattern: `add-participant-{advisorId}-{randevuKey}`.
657
+
658
+ ### 14.15 Active reservation update (`rezervation-update`)
659
+
660
+ `randevuKey` is the reservation `key`. Send `startDateTime`, `endDateTime`, and/or `advisor` as needed. With **`autoProcess: true`** the flow may auto-validate; with **`false`**, after `start` send updates via **`PATCH .../transitions/to-validate`** ([rezervation-update.json](../Workflows/rezervation-update.json)).
661
+
662
+ ```bash
663
+ curl --location '{{BaseUrl}}/morph-touch/workflows/rezervation-update/instances/start?sync=true' \
664
+ --header 'Content-Type: application/json' \
665
+ --header 'Accept-Language: tr-TR' \
666
+ --header 'X-Request-Id: <uuid>' \
667
+ --header 'Authorization: Bearer <access_token>' \
668
+ --data '{
669
+ "key": "rezervation-update-<unique-suffix>",
670
+ "tags": ["rezervation", "randevu", "update"],
671
+ "attributes": {
672
+ "randevuKey": "rez-<unique-suffix>",
673
+ "startDateTime": "2026-02-03T10:00:00",
674
+ "endDateTime": "2026-02-03T10:30:00",
675
+ "advisor": "<newAdvisorRef>",
676
+ "autoProcess": true
677
+ }
678
+ }'
679
+ ```
680
+
681
+ ### 14.16 Permanent chat — `start-chat`
682
+
683
+ Creates room if missing; otherwise **`in-chat`**. `user` is the customer; `advisorType` **`PM`** or **`IA`**; `advisorId` unique advisor id.
684
+
685
+ ```bash
686
+ curl --location '{{BaseUrl}}/morph-touch/workflows/start-chat/instances/start?sync=true' \
687
+ --header 'Content-Type: application/json' \
688
+ --header 'Accept-Language: tr-TR' \
689
+ --header 'X-Request-Id: <uuid>' \
690
+ --header 'Authorization: Bearer <access_token>' \
691
+ --data '{
692
+ "key": "start-chat-<unique-suffix>",
693
+ "tags": ["chat", "start-chat"],
694
+ "attributes": {
695
+ "user": "<userRef>",
696
+ "advisorType": "IA",
697
+ "advisorId": "<advisorId>"
698
+ }
699
+ }'
700
+ ```
701
+
702
+ ### 14.17 Chat rooms and messages (domain functions)
703
+
704
+ Canonical paths: **`GET {{BaseUrl}}/morph-touch/functions/get-chat-rooms`** and **`GET .../functions/get-room-messages`**. Some gateways may use a different prefix.
705
+
706
+ **`get-chat-rooms`:** `user` **or** `advisor` (not both). Optional `roomType`: `permanent` or `rezervation`.
707
+
708
+ **Note:** [GetChatRoomsMapping](../Functions/src/GetChatRoomsMapping.csx) may query instances with a fixed internal `pageSize=100`; a query `pageSize` parameter may not always apply.
709
+
710
+ ```bash
711
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-chat-rooms?user=<userRef>&roomType=permanent' \
712
+ --header 'Accept: application/json' \
713
+ --header 'Accept-Language: tr-TR' \
714
+ --header 'X-Request-Id: <uuid>' \
715
+ --header 'Authorization: Bearer <access_token>'
716
+ ```
717
+
718
+ **`get-room-messages`:** Required `roomId`, `user`. Optional **`limit`** (default 50 in mapping); optional `from` for pagination.
719
+
720
+ ```bash
721
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-room-messages?roomId=<encodedRoomId>&user=<userRef>&limit=20' \
722
+ --header 'Accept: application/json' \
723
+ --header 'Accept-Language: tr-TR' \
724
+ --header 'X-Request-Id: <uuid>' \
725
+ --header 'Authorization: Bearer <access_token>'
726
+ ```
727
+
728
+ ### 14.18 Reservation list — `get-rezervations`
729
+
730
+ Query: `advisorId`, `userId`, `startDate`, `endDate` — dates optional; filter a range when set.
731
+
732
+ ```bash
733
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-rezervations?advisorId=<advisorId>&startDate=2026-02-01&endDate=2026-02-28' \
734
+ --header 'Accept: application/json' \
735
+ --header 'Accept-Language: tr-TR' \
736
+ --header 'X-Request-Id: <uuid>' \
737
+ --header 'Authorization: Bearer <access_token>'
738
+ ```
739
+
740
+ ---
741
+
328
742
  *This document is derived from code and workflow definitions; runtime URLs and auth may vary by environment.*
@@ -1,6 +1,6 @@
1
1
  # Morph-touch domain — teknik özet
2
2
 
3
- Bu doküman, `morph-touch` domain’indeki randevu (rezervation), yokluk/absence, sohbet odası, bildirim ve transfer akışlarını; workflow tanımları ve görev mapping’lerindeki davranışa dayanarak özetler. API örnekleri [postman_collection.json](../../postman_collection.json) koleksiyonu ile uyumludur.
3
+ Bu doküman, `morph-touch` domain’indeki randevu (rezervation), yokluk/absence, sohbet odası, bildirim ve transfer akışlarını; workflow tanımları ve görev mapping’lerindeki davranışa dayanarak özetler. HTTP örnekleri **`{{BaseUrl}}/morph-touch/...`** şablonunu kullanır; [postman_collection.json](../../postman_collection.json) farklı değişkenlerle (`api/v{{apiVersion}}` vb.) tanımlı olabilir — ortamınızda `baseUrl` ve yol önekini gateway şemanıza göre hizalayın.
4
4
 
5
5
  İngilizce sürüm: [morph-touch-domain.en.md](morph-touch-domain.en.md).
6
6
 
@@ -9,7 +9,7 @@ Bu doküman, `morph-touch` domain’indeki randevu (rezervation), yokluk/absence
9
9
  ## 1. Genel bakış ve terminoloji
10
10
 
11
11
  - **Domain:** `morph-touch`
12
- - **Workflow instance:** `key`, `flow` (`sys-flows`), `domain`, `version` ile tanımlı vNext instance modeli; HTTP üzerinden `.../workflows/{flowKey}/instances/...` ile başlatılır ve geçişler `.../transitions/{transitionKey}` ile tetiklenir.
12
+ - **Workflow instance:** `key`, `flow` (`sys-flows`), `domain`, `version` ile tanımlı vNext instance modeli; HTTP üzerinden `.../workflows/{flowKey}/instances/...` ile başlatılır ve geçişler `.../transitions/{transitionKey}` ile tetiklenir. `instances/` sonrası yolda platform **instance id** (UUID) veya `start` isteğinde verilen instance **`key`** kullanılabilir.
13
13
  - **Entegrasyonlar:**
14
14
  - **DAPR / uygulama API:** `api/v{version}/{domain}/...` (mapping’lerde geçen `functions/state`, `functions/data` yolları).
15
15
  - **Matrix:** `MatrixBaseUrl` (secret); oda oluşturma, join, invite, kick, history visibility.
@@ -63,6 +63,8 @@ flowchart LR
63
63
 
64
64
  Kayıtlar çoğunlukla `complete` durumunda tutulur; `update` ile güncellenir, `cancel` ile `cancelled` olur.
65
65
 
66
+ Detaylı istek gövdeleri, anahtar kuralları ve cURL örnekleri için **§14**’e bakın.
67
+
66
68
  ### Randevu transferi ile bağlantı
67
69
 
68
70
  - Geçiş **`start-transfer`** yalnızca `absenceType == "personal-leave"` iken değerlendirilir (`CanStartTransferMapping` — [Workflows/src/CanStartTransferMapping.csx](../Workflows/src/CanStartTransferMapping.csx)).
@@ -276,13 +278,14 @@ Detaylı HTTP örnekleri için [Functions/get-room-messages.http](../Functions/g
276
278
  ### Workflow API şablonları
277
279
 
278
280
  - **Instance başlat:**
279
- `POST {{baseUrl}}/api/v{{apiVersion}}/{{domain}}/workflows/{flowKey}/instances/start?sync=true`
281
+ `POST {{baseUrl}}/morph-touch/workflows/{flowKey}/instances/start?sync=true`
280
282
  Örnek: `rezervation`, `absence-entry`, `rezervation-start`, `chat-room`, `start-chat`, `rezervation-transfer`, `notification-sender` (alt süreç).
281
283
  - **Instance oku:**
282
- `GET .../workflows/{flowKey}/instances/{{instanceId}}`
284
+ `GET {{baseUrl}}/morph-touch/workflows/{flowKey}/instances/{{instanceIdOrKey}}`
285
+ Yol segmenti: platform **instance `id`** (UUID) veya `start` isteğinde verilen instance **`key`** (ör. `working-hour`, `rez-...`).
283
286
  - **Geçiş:**
284
- `PATCH .../workflows/{flowKey}/instances/{{instanceId}}/transitions/{transitionKey}?sync=true`
285
- Gövde genelde `{ "attributes": { ... } }`.
287
+ `PATCH {{baseUrl}}/morph-touch/workflows/{flowKey}/instances/{{instanceIdOrKey}}/transitions/{transitionKey}?sync=true`
288
+ Aynı şekilde **id** veya **`key`** kullanılabilir. Gövde genelde `{ "attributes": { ... } }`.
286
289
 
287
290
  ### Örnek istekler (koleksiyon klasörleri)
288
291
 
@@ -325,4 +328,418 @@ Koleksiyon içi açıklamalar: instance filtreleme ve görev tipleri için [vNex
325
328
 
326
329
  ---
327
330
 
331
+ ## 14. API kullanım kılavuzu (cURL ve alan kuralları)
332
+
333
+ ### 14.1 Ön koşul ve sıra
334
+
335
+ Randevu ve **get-available-slots** mantığı için önce **şirket çalışma saatleri** kaydının oluşturulması önerilir (`absenceType: working-hours-change`, instance `key: "working-hour"`, tags `working-hours-change` + `company`). Ardından resmi tatiller, danışman izinleri / özel çalışma saatleri ve rezervasyon akışı kullanılabilir.
336
+
337
+ ### 14.2 `{{BaseUrl}}`, yol şablonu ve kimlik doğrulama
338
+
339
+ - Tüm örneklerde **`{{BaseUrl}}`**, ortamınızdaki API gateway **kökünü** temsil eder (örneğin `https://<host>` veya kurulumunuza göre `https://<host>/ebanking`). Değeri APISIX / ortam dokümantasyonunuza göre ayarlayın; kökün sonunda `/` bırakmayın veya birleştirmede **çift slash** (`//morph-touch`) oluşmamasına dikkat edin.
340
+ - Standart şablon: **`{{BaseUrl}}/morph-touch/workflows/...`** ve **`{{BaseUrl}}/morph-touch/functions/...`** (örnek: `{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true`).
341
+ - Postman koleksiyonundaki `{{baseUrl}}` ile aynı rolde düşünülebilir; isimlendirme dokümanda `{{BaseUrl}}` olarak verilmiştir.
342
+ - **`Authorization: Bearer <access_token>`:** Erişim jetonu **ortama göre** verilir (geliştirme, test, üretim). Token’ı ilgili kimlik sağlayıcısından veya ortamınızın (APISIX, API portalı, güvenlik ekibi) verdiği yöntemle alın; örneklerdeki `<access_token>` yalnızca yer tutucudur. Gerçek token’ları repoya veya paylaşılan dokümana yapıştırmayın.
343
+ - `.../workflows/{flowKey}/instances/<segment>/...` adresindeki `<segment>`: **`{{instanceIdOrKey}}`** — ya platformun döndüğü **instance id** ya da instance **`key`** değeridir.
344
+
345
+ ### 14.3 Şirket çalışma saatleri — `absence-entry` start (tek sefer)
346
+
347
+ `key` **sabit** `working-hour` olmalıdır. `absenceType` **`working-hours-change`**. `customWorkingHours` altında haftanın günleri (`monday` … `sunday`) tanımlanır; her gün **dizi** olup elemanlar `{ "start": "HH:mm", "end": "HH:mm" }` şeklindedir.
348
+
349
+ ```bash
350
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
351
+ --header 'Content-Type: application/json' \
352
+ --header 'Accept-Language: tr-TR' \
353
+ --header 'X-Request-Id: <uuid>' \
354
+ --header 'Authorization: Bearer <access_token>' \
355
+ --data '{
356
+ "key": "working-hour",
357
+ "tags": ["working-hours-change", "company"],
358
+ "attributes": {
359
+ "absenceType": "working-hours-change",
360
+ "title": "Şirket Çalışma Saatleri",
361
+ "customWorkingHours": {
362
+ "monday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
363
+ "tuesday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
364
+ "wednesday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
365
+ "thursday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "18:00"}],
366
+ "friday": [{"start": "09:00", "end": "12:00"}, {"start": "13:30", "end": "17:00"}],
367
+ "saturday": [],
368
+ "sunday": []
369
+ }
370
+ }
371
+ }'
372
+ ```
373
+
374
+ ### 14.4 Şirket çalışma saatleri — sonraki güncellemeler (`update`)
375
+
376
+ Aynı domainde şirket kaydı genelde **bir kez** `start` ile açılır; sonrasında yalnızca **`PATCH .../transitions/update`** kullanılır. URL’de **`{{instanceIdOrKey}}`** olarak ya yanıttaki **platform instance id** (UUID) ya da şirket kaydı için sabit **`key`** (`working-hour`) kullanılabilir.
377
+
378
+ ```bash
379
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/{{instanceIdOrKey}}/transitions/update?sync=true' \
380
+ --header 'Content-Type: application/json' \
381
+ --header 'Accept-Language: tr-TR' \
382
+ --header 'X-Request-Id: <uuid>' \
383
+ --header 'Authorization: Bearer <access_token>' \
384
+ --data '{
385
+ "attributes": {
386
+ "title": "Şirket Çalışma Saatleri (Güncellendi)",
387
+ "customWorkingHours": {
388
+ "monday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
389
+ "tuesday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
390
+ "wednesday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
391
+ "thursday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "17:30"}],
392
+ "friday": [{"start": "08:30", "end": "12:00"}, {"start": "13:00", "end": "16:30"}],
393
+ "saturday": [],
394
+ "sunday": []
395
+ }
396
+ }
397
+ }'
398
+ ```
399
+
400
+ ### 14.5 Resmi tatil (`public-holiday`)
401
+
402
+ `key` deseni: `public-holiday-{tarih}` (örnek: `public-holiday-2026-04-23`). `absenceType` **`public-holiday`**. Tam veya yarım gün için `startDateTime` / `endDateTime` ihtiyaca göre set edilir.
403
+
404
+ ```bash
405
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
406
+ --header 'Content-Type: application/json' \
407
+ --header 'Accept-Language: tr-TR' \
408
+ --header 'X-Request-Id: <uuid>' \
409
+ --header 'Authorization: Bearer <access_token>' \
410
+ --data '{
411
+ "key": "public-holiday-2026-04-23",
412
+ "tags": ["public-holiday"],
413
+ "attributes": {
414
+ "absenceType": "public-holiday",
415
+ "startDateTime": "2026-04-23T00:00:00",
416
+ "endDateTime": "2026-04-23T23:59:59",
417
+ "title": "23 Nisan Ulusal Egemenlik ve Çocuk Bayramı"
418
+ }
419
+ }'
420
+ ```
421
+
422
+ ### 14.6 Kişisel izin (`personal-leave`)
423
+
424
+ `key` deseni: `personal-leave-{advisorId}-{startDateTime}-{endDateTime}`. `absenceType` **`personal-leave`**. `advisor` izin alan danışmanın benzersiz kimliği (çoğunlukla sicil). `advisorType` ortamda kısaltma (**`PM` / `IA`**) veya tam akış değerleri (**`portfolio-manager` / `investment-advisor`**) olarak kullanılabilir; üretim sözleşmenize göre seçin.
425
+
426
+ ```bash
427
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
428
+ --header 'Content-Type: application/json' \
429
+ --header 'Accept-Language: tr-TR' \
430
+ --header 'X-Request-Id: <uuid>' \
431
+ --header 'sub: <kullanici_sub>' \
432
+ --header 'Authorization: Bearer <access_token>' \
433
+ --data '{
434
+ "key": "personal-leave-<advisorId>-2026-04-07T00:00:00-2026-04-07T12:59:59",
435
+ "tags": ["personal-leave"],
436
+ "attributes": {
437
+ "advisor": "<advisorId>",
438
+ "advisorType": "PM",
439
+ "absenceType": "personal-leave",
440
+ "startDateTime": "2026-04-07T00:00:00",
441
+ "endDateTime": "2026-04-07T12:59:59",
442
+ "title": "Müşteri Toplantısı"
443
+ }
444
+ }'
445
+ ```
446
+
447
+ ### 14.7 Danışmana özel çalışma saatleri (`working-hours-change` + advisor)
448
+
449
+ `key` deseni: `working-hour-{advisorId}`. Tags: `working-hours-change`, `advisor`. `advisor` alanı zorunlu; `customWorkingHours` yapısı §14.3 ile aynıdır.
450
+
451
+ ```bash
452
+ curl --location '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/start?sync=true' \
453
+ --header 'Content-Type: application/json' \
454
+ --header 'Accept-Language: tr-TR' \
455
+ --header 'X-Request-Id: <uuid>' \
456
+ --header 'Authorization: Bearer <access_token>' \
457
+ --data '{
458
+ "key": "working-hour-<advisorId>",
459
+ "tags": ["working-hours-change", "advisor"],
460
+ "attributes": {
461
+ "advisor": "<advisorId>",
462
+ "absenceType": "working-hours-change",
463
+ "title": "Özel Çalışma Saatleri",
464
+ "customWorkingHours": {
465
+ "monday": [{"start": "10:00", "end": "12:00"}, {"start": "13:00", "end": "19:00"}],
466
+ "tuesday": [],
467
+ "wednesday": [],
468
+ "thursday": [],
469
+ "friday": [],
470
+ "saturday": [],
471
+ "sunday": []
472
+ }
473
+ }
474
+ }'
475
+ ```
476
+
477
+ ### 14.8 İptal — `cancel` geçişi
478
+
479
+ ```bash
480
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/{{instanceIdOrKey}}/transitions/cancel?sync=true' \
481
+ --header 'Content-Type: application/json' \
482
+ --header 'Accept-Language: tr-TR' \
483
+ --header 'X-Request-Id: <uuid>' \
484
+ --header 'Authorization: Bearer <access_token>' \
485
+ --data '{"attributes": {}}'
486
+ ```
487
+
488
+ ### 14.9 Yokluk güncelleme — `update` (örnek: izin tarihleri)
489
+
490
+ ```bash
491
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/absence-entry/instances/{{instanceIdOrKey}}/transitions/update?sync=true' \
492
+ --header 'Content-Type: application/json' \
493
+ --header 'Accept-Language: tr-TR' \
494
+ --header 'X-Request-Id: <uuid>' \
495
+ --header 'Authorization: Bearer <access_token>' \
496
+ --data '{
497
+ "attributes": {
498
+ "startDateTime": "2026-01-28T15:00:00",
499
+ "endDateTime": "2026-01-28T17:00:00",
500
+ "title": "Müşteri Toplantısı (Güncellendi)"
501
+ }
502
+ }'
503
+ ```
504
+
505
+ ### 14.10 `get-absence-entry` fonksiyonu
506
+
507
+ `absenceType` zorunlu; şirket çalışma saatleri için yalnız `working-hours-change` gönderildiğinde şirket geneli kayıtlar döner. Tarih aralığı ile resmi tatiller; `advisor` ile danışman çalışma saatleri.
508
+
509
+ ```bash
510
+ # Şirket çalışma saatleri
511
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-absence-entry?absenceType=working-hours-change' \
512
+ --header 'Accept: application/json' \
513
+ --header 'Accept-Language: tr-TR' \
514
+ --header 'X-Request-Id: <uuid>' \
515
+ --header 'Authorization: Bearer <access_token>'
516
+
517
+ # Resmi tatiller (tarih aralığı)
518
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-absence-entry?absenceType=public-holiday&startDate=2026-04-01T00:00:00&endDate=2026-04-30T23:59:59' \
519
+ --header 'Accept: application/json' \
520
+ --header 'Accept-Language: tr-TR' \
521
+ --header 'X-Request-Id: <uuid>' \
522
+ --header 'Authorization: Bearer <access_token>'
523
+
524
+ # Danışman özel çalışma saatleri
525
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-absence-entry?absenceType=working-hours-change&advisor=<advisorId>' \
526
+ --header 'Accept: application/json' \
527
+ --header 'Accept-Language: tr-TR' \
528
+ --header 'X-Request-Id: <uuid>' \
529
+ --header 'Authorization: Bearer <access_token>'
530
+ ```
531
+
532
+ ### 14.11 `get-available-slots`
533
+
534
+ Belirtilen `advisorId` ve `date` için o günkü boş slotları döner; `duration` isteğe bağlıdır (dakika).
535
+
536
+ ```bash
537
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-available-slots?advisorId=<advisorId>&date=2026-03-17' \
538
+ --header 'Accept: application/json' \
539
+ --header 'Accept-Language: tr-TR' \
540
+ --header 'X-Request-Id: <uuid>' \
541
+ --header 'Authorization: Bearer <access_token>'
542
+ ```
543
+
544
+ Örnek gövde:
545
+
546
+ ```json
547
+ {
548
+ "getAvailableSlots": {
549
+ "availableSlots": [
550
+ "09:00-09:30",
551
+ "09:30-10:00",
552
+ "10:00-10:30"
553
+ ]
554
+ }
555
+ }
556
+ ```
557
+
558
+ ### 14.12 Rezervasyon akışı (`rezervation`)
559
+
560
+ 1. **`start`:** `key` her rezervasyon için benzersiz olmalıdır; sonraki adımlarda `randevuKey` olarak bu değer kullanılır. `user`, `advisor`, `startDateTime`, `endDateTime` — slotlarla uyumlu aralık seçin. **`sub`** header’ı token’dan veya açıkça gönderilir (müşteri kimliği).
561
+ 2. Geçmiş tarih veya aynı kullanıcı için kurallara aykırı ikinci aktif rezervasyon varsa oluşturma reddedilebilir (bkz. §4 / §12).
562
+ 3. State **`slot-unavailable`** ise **`appointment-form-retry`** ile yeni tarih/saat gönderilir.
563
+ 4. **`appointment-form`** sonrası **`confirm-selection`** ile kullanıcı girdisi onaylanır.
564
+ 5. **`create-appointment`** ile durum **`active`** olur; arka planda bildirim ve kullanıcı bilgisi (`get-user-info-for-rezervation`) çalışır, SMS kayıtlı telefona gider.
565
+
566
+ Aşağıdaki geçiş çağrılarında `instances/` sonrasına **platform instance id** veya `start` ile verdiğiniz rezervasyon **`key`** (ör. `rez-<unique-suffix>`) yazılabilir (`{{rezervationInstanceIdOrKey}}`).
567
+
568
+ ```bash
569
+ curl --location '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/start?sync=true' \
570
+ --header 'Content-Type: application/json' \
571
+ --header 'Accept-Language: tr-TR' \
572
+ --header 'X-Request-Id: <uuid>' \
573
+ --header 'sub: <customer_sub>' \
574
+ --header 'Authorization: Bearer <access_token>' \
575
+ --data '{
576
+ "key": "rez-<unique-suffix>",
577
+ "tags": ["appointment", "randevu"],
578
+ "attributes": {
579
+ "user": "<userRef>",
580
+ "advisor": "<advisorRef>",
581
+ "startDateTime": "2026-04-17T10:30:00",
582
+ "endDateTime": "2026-04-17T11:00:00"
583
+ }
584
+ }'
585
+ ```
586
+
587
+ ```bash
588
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/{{rezervationInstanceIdOrKey}}/transitions/appointment-form-retry?sync=true' \
589
+ --header 'Content-Type: application/json' \
590
+ --header 'Accept-Language: tr-TR' \
591
+ --header 'X-Request-Id: <uuid>' \
592
+ --header 'Authorization: Bearer <access_token>' \
593
+ --data '{
594
+ "attributes": {
595
+ "startDateTime": "2026-04-17T11:00:00",
596
+ "endDateTime": "2026-04-17T11:30:00"
597
+ }
598
+ }'
599
+ ```
600
+
601
+ ```bash
602
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/{{rezervationInstanceIdOrKey}}/transitions/confirm-selection?sync=true' \
603
+ --header 'Content-Type: application/json' \
604
+ --header 'Accept-Language: tr-TR' \
605
+ --header 'X-Request-Id: <uuid>' \
606
+ --header 'Authorization: Bearer <access_token>' \
607
+ --data '{"attributes": {}}'
608
+ ```
609
+
610
+ ```bash
611
+ curl --location --request PATCH '{{BaseUrl}}/morph-touch/workflows/rezervation/instances/{{rezervationInstanceIdOrKey}}/transitions/create-appointment?sync=true' \
612
+ --header 'Content-Type: application/json' \
613
+ --header 'Accept-Language: tr-TR' \
614
+ --header 'X-Request-Id: <uuid>' \
615
+ --header 'Authorization: Bearer <access_token>' \
616
+ --data '{"attributes": {}}'
617
+ ```
618
+
619
+ ### 14.13 Görüşme başlatma (`rezervation-start`)
620
+
621
+ Randevu başlangıcına **en fazla 15 dakika** kala çağrılabilir; daha erken ise **`meet-not-started`** benzeri dala düşer. `randevuKey` ilgili rezervasyonun `key` değeridir. `participantType`: `customer`, `advisor` veya `invited`; **`invited`** ise **`invitedUserId`** zorunludur ve kullanıcı önce **add-participant-to-rezervation** akışı ile rezervasyona eklenmiş olmalıdır. İlk katılımcı Matrix odasını oluşturur ve rezervasyon **`in-meet`** olur; ikinci katılımcı **join** eder ve LiveKit URL’leri rezervasyon datasına yazılır.
622
+
623
+ ```bash
624
+ curl --location '{{BaseUrl}}/morph-touch/workflows/rezervation-start/instances/start?sync=true' \
625
+ --header 'Content-Type: application/json' \
626
+ --header 'Accept-Language: tr-TR' \
627
+ --header 'X-Request-Id: <uuid>' \
628
+ --header 'Authorization: Bearer <access_token>' \
629
+ --data '{
630
+ "key": "randevu-<unique-suffix>",
631
+ "tags": ["randevu", "meeting"],
632
+ "attributes": {
633
+ "randevuKey": "rez-<unique-suffix>",
634
+ "participantType": "advisor"
635
+ }
636
+ }'
637
+ ```
638
+
639
+ Davetli örneği: `participantType: "invited"` ve `invitedUserId: "<davetliId>"` ekleyin.
640
+
641
+ ### 14.14 Rezervasyona katılımcı ekleme (`add-participant-to-rezervation`)
642
+
643
+ ```bash
644
+ curl --location '{{BaseUrl}}/morph-touch/workflows/add-participant-to-rezervation/instances/start?sync=true' \
645
+ --header 'Content-Type: application/json' \
646
+ --header 'Accept-Language: tr-TR' \
647
+ --header 'X-Request-Id: <uuid>' \
648
+ --header 'Authorization: Bearer <access_token>' \
649
+ --data '{
650
+ "key": "add-participant-<unique-suffix>",
651
+ "tags": ["rezervation", "add-participant"],
652
+ "attributes": {
653
+ "randevuKey": "rez-<unique-suffix>",
654
+ "newUserId": "<davetEdilecekSicil>"
655
+ }
656
+ }'
657
+ ```
658
+
659
+ Önerilen `key` deseni: `add-participant-{advisorId}-{randevuKey}` (benzersizlik için).
660
+
661
+ ### 14.15 Aktif rezervasyon güncelleme (`rezervation-update`)
662
+
663
+ `randevuKey` güncellenecek rezervasyonun `key` değeridir. `startDateTime`, `endDateTime`, `advisor` ihtiyaca göre gönderilir. **`autoProcess: true`** ise akış doğrulamayı otomatik ilerletebilir; **`false`** ise `start` sonrası güncelleme değerleri **`PATCH .../transitions/to-validate`** ile gönderilir ([rezervation-update.json](../Workflows/rezervation-update.json)).
664
+
665
+ ```bash
666
+ curl --location '{{BaseUrl}}/morph-touch/workflows/rezervation-update/instances/start?sync=true' \
667
+ --header 'Content-Type: application/json' \
668
+ --header 'Accept-Language: tr-TR' \
669
+ --header 'X-Request-Id: <uuid>' \
670
+ --header 'Authorization: Bearer <access_token>' \
671
+ --data '{
672
+ "key": "rezervation-update-<unique-suffix>",
673
+ "tags": ["rezervation", "randevu", "update"],
674
+ "attributes": {
675
+ "randevuKey": "rez-<unique-suffix>",
676
+ "startDateTime": "2026-02-03T10:00:00",
677
+ "endDateTime": "2026-02-03T10:30:00",
678
+ "advisor": "<yeniAdvisorRef>",
679
+ "autoProcess": true
680
+ }
681
+ }'
682
+ ```
683
+
684
+ ### 14.16 Kalıcı sohbet — `start-chat`
685
+
686
+ Oda yoksa oluşturulur; varsa doğrudan **`in-chat`**. `user` sohbeti başlatan müşteri; `advisorType` **`PM`** veya **`IA`**; `advisorId` danışmanın benzersiz kimliği (sicil).
687
+
688
+ ```bash
689
+ curl --location '{{BaseUrl}}/morph-touch/workflows/start-chat/instances/start?sync=true' \
690
+ --header 'Content-Type: application/json' \
691
+ --header 'Accept-Language: tr-TR' \
692
+ --header 'X-Request-Id: <uuid>' \
693
+ --header 'Authorization: Bearer <access_token>' \
694
+ --data '{
695
+ "key": "start-chat-<unique-suffix>",
696
+ "tags": ["chat", "start-chat"],
697
+ "attributes": {
698
+ "user": "<userRef>",
699
+ "advisorType": "IA",
700
+ "advisorId": "<advisorId>"
701
+ }
702
+ }'
703
+ ```
704
+
705
+ ### 14.17 Sohbet odaları ve mesajlar (domain fonksiyonları)
706
+
707
+ Canonical yol: **`GET {{BaseUrl}}/morph-touch/functions/get-chat-rooms`** ve **`GET .../functions/get-room-messages`**. Bazı gateway kurulumlarında farklı önek olabilir.
708
+
709
+ **`get-chat-rooms`:** `user` **veya** `advisor` (ikisi birden değil). İsteğe bağlı `roomType`: `permanent` veya `rezervation`.
710
+
711
+ **Not:** [GetChatRoomsMapping](../Functions/src/GetChatRoomsMapping.csx) içinde instance sorgusu şu an sabit `pageSize=100` ile yapılabilir; query’de `pageSize` geçmek her zaman etkili olmayabilir.
712
+
713
+ ```bash
714
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-chat-rooms?user=<userRef>&roomType=permanent' \
715
+ --header 'Accept: application/json' \
716
+ --header 'Accept-Language: tr-TR' \
717
+ --header 'X-Request-Id: <uuid>' \
718
+ --header 'Authorization: Bearer <access_token>'
719
+ ```
720
+
721
+ **`get-room-messages`:** Zorunlu `roomId`, `user`. İsteğe bağlı **`limit`** (varsayılan mapping tarafında 50); sayfalama için `from` token’ı kullanılabilir.
722
+
723
+ ```bash
724
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-room-messages?roomId=<encodedRoomId>&user=<userRef>&limit=20' \
725
+ --header 'Accept: application/json' \
726
+ --header 'Accept-Language: tr-TR' \
727
+ --header 'X-Request-Id: <uuid>' \
728
+ --header 'Authorization: Bearer <access_token>'
729
+ ```
730
+
731
+ ### 14.18 Rezervasyon listesi — `get-rezervations`
732
+
733
+ Query: `advisorId`, `userId`, `startDate`, `endDate` — tarihler zorunlu değildir; aralık filtrelemek için kullanılır.
734
+
735
+ ```bash
736
+ curl --location '{{BaseUrl}}/morph-touch/functions/get-rezervations?advisorId=<advisorId>&startDate=2026-02-01&endDate=2026-02-28' \
737
+ --header 'Accept: application/json' \
738
+ --header 'Accept-Language: tr-TR' \
739
+ --header 'X-Request-Id: <uuid>' \
740
+ --header 'Authorization: Bearer <access_token>'
741
+ ```
742
+
743
+ ---
744
+
328
745
  *Bu doküman, kod ve workflow tanımlarına göre oluşturulmuştur; çalışma zamanı URL’leri ve auth şeması ortamınıza göre değişebilir.*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burgan-tech/morph-touch-runtime",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "morph-touch - Runtime Package for engine deployment",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/vnext.config.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.6",
2
+ "version": "0.0.7",
3
3
  "description": "morph-touch Domain Definition Configuration",
4
4
  "domain": "morph-touch",
5
5
  "runtimeVersion": "0.0.41",