Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

deep update on one to many composition #116

Closed
lellavasundhara opened this issue May 3, 2021 · 4 comments
Closed

deep update on one to many composition #116

lellavasundhara opened this issue May 3, 2021 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed localization support for localized entities

Comments

@lellavasundhara
Copy link

Hello Team,

I have an entity like below

entity Students {

key id: string(10);

name: string(30);

title: localized string(40);

}

I want to do deep update on Students entity.

I do put request.

My URL is 'https://localhost:4004/v2/StudentService/Students(1)'

and Payload is :

{ id : '1',

name: 'test',

texts:[{locale: 'en',title: 'Guntur'}]

}

It shows error like below

deep update issue

I am using Node js with PostgreSQL Database. It's working SQLite Database.
Please help me

@gregorwolf
Copy link
Contributor

Hi @lellavasundhara ,

right now we've not used localized in our datamodel. It would be great if you can enhance the cds-pg project and add an Entity Styles to tests/assets/cap-proj/db/schema.cds. That would make a good example for a localized entity. Then also add a test that replicates the issue.

Best regards
Gregor

@tiger0328
Copy link

Hello @gregorwolf
I ran into similar issue when try to update one to many composition.
Here is the model with one to many composition:

entity Req {
key Id : UUID;
title : String(100);
amount : Amount;
status : Status;
comments : String(1000);
reqLines : Composition of many ReqLines
on reqLines.req = $self
}

entity ReqLines {
key Id : UUID;
req : Association to Req;
item : String(100);
quantity : Integer;
price : Price;
}

when I try to send the payload using PUT method in postman like this:
image
Error messages:
image

The same use case works fine for sqlite.

Best Regards and Thanks.

@vobu
Copy link
Collaborator

vobu commented Jul 15, 2021

hi @tiger0328 - the same thing indeed applies to your example: you're using a pseudo-localized version of currency; that -as @gregorwolf pointed out- we do not yet have available in cds-pg.
And, as also @gregorwolf has pointed out above, "it would be great if you can enhance the cds-pg project and add an Entity Styles to tests/assets/cap-proj/db/schema.cds. That would make a good example for a localized entity. Then also add a test that replicates the issue."

@vobu vobu added enhancement New feature or request localization support for localized entities help wanted Extra attention is needed labels Jul 15, 2021
@isreven
Copy link

isreven commented Nov 17, 2021

Hello Team,

I have entities like below (with many to many relations)

entity WorkSpace : managed {
key ID : String;
Editable : Boolean;
WorkPages : Composition of many { // many-to-many relationship
key Instance : Association to WorkPage;
}
Sites : Association to many Site.WorkSpaces
on Sites.Instance = $self; // many-to-many backlink
Roles : Association to many Role.WorkSpaces
on Roles.Instance = $self; // many-to-many backlink
}

entity Role {
key ID : String;
WorkSpaces : Composition of many { // many-to-many relationship
key Instance : Association to WorkSpace;
}
}

When I tried to patch Specific Role with WorkSpaces
PATCH {{path}}/Roles('R_1')

We get the same error @lellavasundhara got.

version of cds-pg - 0.1.14
version of cds - 5.1.5
version of cds-dbm - 0.0.27

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed localization support for localized entities
Projects
None yet
Development

No branches or pull requests

5 participants