Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4e92dca
Merge pull request #9 from buerokratt/dev
ruwinirathnamalala Apr 27, 2026
a103464
Acecess a common create/edit endpoind modal from both service flow an…
ruwinirathnamalala Apr 27, 2026
eba6a67
Custome endpoint create/edit flows implemented
ruwinirathnamalala Apr 28, 2026
8d4e80a
OpenApi endpoint create/edit flows implemented
ruwinirathnamalala Apr 28, 2026
25b0385
Parameter mandatory option added
ruwinirathnamalala Apr 29, 2026
b9723e9
get all endpoints for service-creation flow
ruwinirathnamalala Apr 29, 2026
ac91b02
Issues fixed in OpenApi Edit modal
ruwinirathnamalala Apr 29, 2026
bbd99b7
GUI format issues fixed
ruwinirathnamalala Apr 29, 2026
2dec06b
GUI lint issues fixed
ruwinirathnamalala Apr 29, 2026
9702883
GUI lint issues fixed
ruwinirathnamalala May 4, 2026
443e815
GUI lint issues fixed
ruwinirathnamalala May 4, 2026
031d79d
Removed public/private endpoint distinction from both service flow an…
ruwinirathnamalala May 4, 2026
c861e54
Merge pull request #10 from buerokratt/dev
ruwinirathnamalala May 6, 2026
83ecb19
Merge branch 'dev' of https://github.com/rootcodelabs/Service-Module …
ruwinirathnamalala May 6, 2026
d8fb22b
API Endpoint Modal Alignment - implemented
ruwinirathnamalala May 7, 2026
4641f2d
Fix in edit flow
ruwinirathnamalala May 7, 2026
e5edd3d
Undo redundant changes in edpint edit flow
ruwinirathnamalala May 7, 2026
af3d262
GUI lint issues fixed
ruwinirathnamalala May 7, 2026
1344c26
GUI lint issues fixed
ruwinirathnamalala May 7, 2026
2757c93
Button styling added
ruwinirathnamalala May 8, 2026
1201193
changes related to displaying response Schema of endpoints
ruwinirathnamalala May 8, 2026
279f846
sonar issue fixes
ruwinirathnamalala May 8, 2026
91e1052
Pull from 928 task - displar response schema
ruwinirathnamalala May 8, 2026
5a5b363
Pull from 928 task - displar response schema
ruwinirathnamalala May 8, 2026
9cc65c2
Merge branch '951/remove_public_private_endpoint_distiction' of https…
ruwinirathnamalala May 8, 2026
e57cb7c
Missed validation added
ruwinirathnamalala May 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

<changeSet id="20260428120000" author="ruwiniRathnamalala">
<sqlFile path="changelog/migrations/20260428120000_add-description-to-endpoints.sql" />
<rollback>
<sqlFile path="changelog/migrations/rollback/20260428120000_add-description-to-endpoints_rollback.sql" />
</rollback>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

<changeSet id="20260504120000" author="ruwiniRathnamalala">
<sqlFile path="changelog/migrations/20260504120000_remove-is-common-from-endpoints.sql" />
<rollback>
<sqlFile path="changelog/migrations/rollback/20260504120000_remove-is-common-from-endpoints_rollback.sql" />
</rollback>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- liquibase formatted sql

ALTER TABLE endpoints
ADD COLUMN description TEXT NOT NULL DEFAULT '';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE endpoints DROP COLUMN IF EXISTS is_common;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- liquibase formatted sql
-- rollback

ALTER TABLE endpoints
DROP COLUMN description;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE endpoints ADD COLUMN IF NOT EXISTS is_common BOOLEAN NOT NULL DEFAULT FALSE;
8 changes: 4 additions & 4 deletions DSL/Resql/services/POST/endpoints/create_endpoint.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ INSERT INTO endpoints (
service_id,
name,
type,
is_common,
definitions
definitions,
description
)
VALUES (
:endpointId::uuid,
NULLIF(:serviceId, '')::uuid,
:name,
:type::endpoint_type,
:isCommon,
:definitions::jsonb
:definitions::jsonb,
:description
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
UPDATE endpoints
SET deleted = TRUE
WHERE service_id = :serviceId::uuid
AND is_common = FALSE
AND deleted = FALSE;
27 changes: 27 additions & 0 deletions DSL/Resql/services/POST/endpoints/get_all_endpoints.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
WITH UserPreferences AS (
SELECT endpoints
FROM user_step_preference
WHERE user_id_code = :user_id_code
ORDER BY created_at DESC
LIMIT 1
)
SELECT
e.endpoint_id,
e.name,
e.description,
e.type,
e.definitions,
e.response_schema
FROM endpoints AS e
CROSS JOIN UserPreferences AS up
WHERE e.deleted IS FALSE
AND (:search IS NULL OR :search = '' OR LOWER(e.name) LIKE LOWER('%' || :search || '%'))
ORDER BY
CASE
WHEN up.endpoints IS NULL OR array_length(up.endpoints, 1) = 0 THEN 1
ELSE array_position(up.endpoints, e.endpoint_id)
END,
CASE
WHEN up.endpoints IS NULL OR array_length(up.endpoints, 1) = 0 THEN e.id
ELSE NULL
END DESC;
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ WITH UserPreferences AS (
SELECT
e.endpoint_id,
e.name,
e.description,
e.type,
e.is_common,
e.definitions
FROM endpoints AS e
CROSS JOIN UserPreferences AS up
WHERE (e.service_id = :id::uuid OR e.is_common = true)
WHERE (e.service_id = :id::uuid OR e.deleted = false)
AND e.deleted IS FALSE
AND (:search IS NULL OR :search = '' OR LOWER(e.name) LIKE LOWER('%' || :search || '%'))
ORDER BY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ SELECT
endpoint_id,
service_id,
name,
description,
type,
is_common,
definitions,
last_test_at,
verification_status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ SET endpoints = COALESCE((
SELECT endpoint_id
FROM endpoints
WHERE service_id = :serviceId::uuid
AND is_common = FALSE
AND deleted = FALSE
)
), ARRAY[]::uuid[])
Expand All @@ -20,7 +19,6 @@ WHERE EXISTS (
SELECT endpoint_id
FROM endpoints
WHERE service_id = :serviceId::uuid
AND is_common = FALSE
AND deleted = FALSE
)
);
6 changes: 3 additions & 3 deletions DSL/Resql/services/POST/endpoints/update_endpoint.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
UPDATE endpoints
SET
service_id = :serviceId::uuid,
service_id = NULLIF(:serviceId, '')::uuid,
name = :name,
type = :type::endpoint_type,
is_common = :isCommon,
definitions = :definitions::jsonb
definitions = :definitions::jsonb,
description = :description
WHERE endpoint_id = :endpointId::uuid;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
declaration:
call: declare
version: 0.1
description: "Decription placeholder for 'Common'"
description: "Returns all endpoints with pagination, sorting and search support"
method: post
accepts: json
returns: json
Expand All @@ -24,10 +24,10 @@ declaration:
type: string
description: "Body field 'search'"

get_common_endpoints:
get_paginated_endpoints:
call: http.post
args:
url: "[#SERVICE_RESQL]/endpoints/get_common_endpoints"
url: "[#SERVICE_RESQL]/endpoints/get_paginated_endpoints"
body:
pagination: ${incoming.body.pagination}
page: ${incoming.body.page}
Expand Down
3 changes: 1 addition & 2 deletions DSL/Ruuter/services/POST/service-by-id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ get_service_by_id:
get_endpoints_by_service_id:
call: http.post
args:
url: "[#SERVICE_RESQL]/endpoints/get_endpoints_by_service_id"
url: "[#SERVICE_RESQL]/endpoints/get_all_endpoints"
body:
id: ${id}
user_id_code: ${idCode}
search: ${search}
result: endpoints_results
Expand Down
9 changes: 5 additions & 4 deletions DSL/Ruuter/services/POST/services/create-endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ declaration:
- field: type
type: string
description: "Endpoint type"
- field: isCommon
type: boolean
description: "Endpoint common status"

- field: serviceId
type: string
description: "Service UUID"
- field: definitions
type: object
description: "Endpoint definitions"
- field: description
type: string
description: "Endpoint description"

create_endpoint:
call: http.post
Expand All @@ -35,9 +36,9 @@ create_endpoint:
endpointId: ${incoming.body.endpointId}
name: ${incoming.body.name}
type: ${incoming.body.type}
isCommon: ${incoming.body.isCommon}
serviceId: ${incoming.body.serviceId ?? ''}
definitions: ${incoming.body.definitions}
description: ${incoming.body.description ?? ''}
result: res

return_ok:
Expand Down
8 changes: 4 additions & 4 deletions DSL/Ruuter/services/POST/services/update-endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ declaration:
- field: type
type: string
description: "Endpoint type"
- field: isCommon
type: boolean
description: "Endpoint common status"
- field: serviceId
type: string
description: "Service UUID"
- field: definitions
type: object
description: "Endpoint definitions"
- field: description
type: string
description: "Endpoint description"
params:
- field: id
type: string
Expand All @@ -45,9 +45,9 @@ update_endpoint:
endpointId: ${id}
name: ${incoming.body.name}
type: ${incoming.body.type}
isCommon: ${incoming.body.isCommon}
serviceId: ${incoming.body.serviceId ?? ''}
definitions: ${incoming.body.definitions}
description: ${incoming.body.description ?? ''}
result: res

return_ok:
Expand Down
81 changes: 9 additions & 72 deletions GUI/src/components/ApiEndpoint/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import ApiEndpointCard from 'components/ApiEndpointCard';
import Box from 'components/Box';
import Button from 'components/Button';
import Icon from 'components/Icon';
import Modal from 'components/Modal';
import Track from 'components/Track';
import { FC, useMemo, useState } from 'react';
import { FC, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { MdDeleteOutline, MdDragIndicator, MdOutlineEdit } from 'react-icons/md';
import { Link } from 'react-router-dom';
import { deleteEndpoint } from 'resources/api-constants';
import { saveEndpoints } from 'services/service-builder';
import useServiceStore from 'store/new-services.store';
import useToastStore from 'store/toasts.store';
import { Step, StepType } from 'types';
Expand All @@ -20,6 +18,7 @@ import { removeTrailingUnderscores } from 'utils/string-util';

import styles from './ApiEndpoint.module.scss';
import api from '../../services/api-dev';
import AddEndpointModal from '../Flow/EdgeTypes/AddEndpointModal';

interface RelatedService {
serviceId: string;
Expand All @@ -45,18 +44,11 @@ const ApiEndpoint: FC<ApiEndpointProps> = ({ step, onClick }) => {
const [relatedServices, setRelatedServices] = useState<RelatedService[]>([]);
const [showEditModal, setShowEditModal] = useState(false);
const [showDeleteModal, setShowDeleteModal] = useState(false);
const [isEditing, setIsEditing] = useState(false);
const [isDeleting, setIsDeleting] = useState(false);
const [endpointNameExists, setEndpointNameExists] = useState<boolean>(false);
const serviceName = useServiceStore((state) => removeTrailingUnderscores(state.serviceNameDashed()));
const nodes = useServiceStore((state) => state.nodes);
const [endpointName, setEndpointName] = useState<string>(step.data?.name ?? '');
const [isCommonEndpoint, setIsCommonEndpoint] = useState<boolean>(step.data?.isCommon ?? false);
const originalEndpoint = useMemo(() => {
return step.data ? (JSON.parse(JSON.stringify(step.data)) as EndpointData) : undefined;
}, [step.data]);

const { deleteEndpoint: deleteEndpointFromStore, setJsonRequestVisible, setJsonRequestContent } = useServiceStore();
const { deleteEndpoint: deleteEndpointFromStore } = useServiceStore();

const deleteSelectedEndpoint = async (endpoint: EndpointData | undefined) => {
if (!endpoint) {
Expand Down Expand Up @@ -120,67 +112,12 @@ const ApiEndpoint: FC<ApiEndpointProps> = ({ step, onClick }) => {
)}

{showEditModal && step?.data && (
<Modal
title={t('newService.editEndpoint')}
onClose={() => {
useServiceStore.getState().editEndpoint(originalEndpoint);
setShowEditModal(false);
setJsonRequestVisible(false);
setJsonRequestContent(null);
}}
>
<Track isMultiline gap={16} direction="vertical" align="stretch">
<ApiEndpointCard
endpoint={step?.data}
onNameExists={setEndpointNameExists}
onNameChange={setEndpointName}
onCommonChange={setIsCommonEndpoint}
/>
<Track justify="end" gap={16}>
<Button
appearance="secondary"
onClick={(e) => {
useServiceStore.getState().editEndpoint(originalEndpoint);
setShowEditModal(false);
setJsonRequestVisible(false);
setJsonRequestContent(null);
e.stopPropagation();
}}
>
{t('overview.cancel')}
</Button>
<Button
appearance={isEditing ? 'loading' : 'primary'}
disabled={endpointName === '' || endpointNameExists}
onClick={(e) => {
const stepData = step.data!;
stepData.name = endpointName;
stepData.isCommon = isCommonEndpoint;
setIsEditing(true);
void saveEndpoints(
[stepData],
() => {
setShowEditModal(false);
setJsonRequestVisible(false);
setJsonRequestContent(null);
e.stopPropagation();
useServiceStore.getState().editEndpoint(stepData);
setIsEditing(false);
useToastStore.getState().success({ title: t('serviceFlow.apiElements.editSuccess') });
},
(error) => {
console.error(`Error Editing API endpoint: ${error}`);
useToastStore.getState().error({ title: t('serviceFlow.apiElements.editError') });
setIsEditing(false);
},
);
}}
>
{t('global.edit')}
</Button>
</Track>
</Track>
</Modal>
<AddEndpointModal
mode="edit"
context="service"
initialEndpoint={step.data}
onClose={() => setShowEditModal(false)}
/>
)}

{relatedServices.length > 0 && (
Expand Down
Loading
Loading