2022-08-13 15:01:15 +02:00
|
|
|
unit MainControllerU;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
MVCFramework, MVCFramework.Commons, MVCFramework.Serializer.Commons;
|
|
|
|
|
|
|
|
type
|
|
|
|
[MVCPath('/api')]
|
|
|
|
TMyController = class(TMVCController)
|
|
|
|
public
|
|
|
|
[MVCPath]
|
|
|
|
[MVCHTTPMethod([httpGET])]
|
|
|
|
procedure Index;
|
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
MVCFramework.ActiveRecord,
|
|
|
|
MVCFramework.SQLGenerators.PostgreSQL,
|
|
|
|
System.SysUtils,
|
|
|
|
MVCFramework.Logger,
|
|
|
|
System.StrUtils,
|
|
|
|
Entities;
|
|
|
|
|
|
|
|
procedure TMyController.Index;
|
|
|
|
begin
|
|
|
|
Render(ObjectDict().Add('people',
|
2022-10-09 15:45:59 +02:00
|
|
|
//TMVCActiveRecord.SelectRQL<TPerson>('and(gt(id, 2),lt(id,6))', 100)
|
|
|
|
TMVCActiveRecord.SelectRQL<TPerson>('sort(+personSurname)', 10)
|
2022-08-13 15:01:15 +02:00
|
|
|
));
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|