{"action":"created","issue":{"url":"https://api.github.com/repos/volkanceylan/Serenity/issues/3484","repository_url":"https://api.github.com/repos/volkanceylan/Serenity","labels_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/3484/labels{/name}","comments_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/3484/comments","events_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/3484/events","html_url":"https://github.com/volkanceylan/Serenity/pull/3484","id":314365809,"number":3484,"title":"generate custom lookup typescript code","user":{"login":"minhhungit","id":2279508,"avatar_url":"https://avatars3.githubusercontent.com/u/2279508?v=4","gravatar_id":"","url":"https://api.github.com/users/minhhungit","html_url":"https://github.com/minhhungit","followers_url":"https://api.github.com/users/minhhungit/followers","following_url":"https://api.github.com/users/minhhungit/following{/other_user}","gists_url":"https://api.github.com/users/minhhungit/gists{/gist_id}","starred_url":"https://api.github.com/users/minhhungit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minhhungit/subscriptions","organizations_url":"https://api.github.com/users/minhhungit/orgs","repos_url":"https://api.github.com/users/minhhungit/repos","events_url":"https://api.github.com/users/minhhungit/events{/privacy}","received_events_url":"https://api.github.com/users/minhhungit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-14T22:05:52Z","updated_at":"2018-04-15T00:47:54Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/volkanceylan/Serenity/pulls/3484","html_url":"https://github.com/volkanceylan/Serenity/pull/3484","diff_url":"https://github.com/volkanceylan/Serenity/pull/3484.diff","patch_url":"https://github.com/volkanceylan/Serenity/pull/3484.patch"},"body":"This is PR for issue https://github.com/volkanceylan/Serenity/issues/3481\r\nSerenity will generate custom lookup script for Row.ts if we define HasCustomLookup attribute\r\n\r\nSample:\r\n```csharp\r\n[HasCustomLookup(typeof(CustomWithAutoKeyLookup))]\r\n[HasCustomLookup(typeof(CustomWithExplicitKeyLookup))]\r\npublic class RowForCustomLookupRow : Row\r\n{\r\n    public class RowFields : RowFieldsBase\r\n    {\r\n    }\r\n\r\n    public static RowFields Fields = new RowFields().Init();\r\n\r\n    public RowForCustomLookupRow()\r\n        : base(Fields)\r\n    {\r\n    }\r\n}\r\n```\r\n\r\nSample result:\r\n```javascript\r\nnamespace ServerTypingsTest.SomeModule {\r\n    export interface RowForCustomLookupRow {\r\n    }\r\n\r\n    export namespace RowForCustomLookupRow {\r\n        export const localTextPrefix = 'SomeModule.RowForCustomLookup';\r\n\r\n        export declare function getLookup_CustomWithAutoKeyLookup(): Q.Lookup<{}>;\r\n        export declare function getLookup_CustomWithExplicitKeyLookup(): Q.Lookup<{}>;\r\n\r\n        export declare function getLookup_CustomWithAutoKeyLookupAsync(): PromiseLike<Q.Lookup<{}>>;\r\n        export declare function getLookup_CustomWithExplicitKeyLookupAsync(): PromiseLike<Q.Lookup<{}>>;\r\n\t\t\r\n        export enum CustomLookups {\r\n            getLookup_CustomWithAutoKeyLookup = \"SomeModule.CustomWithAutoKey\",\r\n            getLookup_CustomWithExplicitKeyLookup = \"This is custom lookup key\"\r\n        }\r\n\r\n        Object.keys(CustomLookups).forEach(x => {\r\n            (<any>RowForCustomLookupRow)[x] = function () {\r\n                return Q.getLookup(CustomLookups[x]);\r\n            };\r\n\r\n            (<any>RowForCustomLookupRow)[x + \"Async\"] = function () {\r\n                return Q.getLookupAsync(CustomLookups[x]);\r\n            };\r\n        });\r\n\r\n\r\n        export declare const enum Fields {\r\n\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/volkanceylan/Serenity/issues/comments/381371825","html_url":"https://github.com/volkanceylan/Serenity/pull/3484#issuecomment-381371825","issue_url":"https://api.github.com/repos/volkanceylan/Serenity/issues/3484","id":381371825,"user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"created_at":"2018-04-15T00:47:54Z","updated_at":"2018-04-15T00:47:54Z","author_association":"NONE","body":"\n![Codacy](https://app.codacy.com/assets/images/favicon.png) Here is an overview of what got changed by this pull request:\n\n\n```diff\n\nIssues\n======\n- Added 6\n           \n\nComplexity increasing per file\n==============================\n- Serenity.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Row.cs  4\n         \n\nClones added\n============\n- Serenity.CodeGenerator/CodeGeneration/ServerTypings/ServerTypingsGenerator.Row.cs  2\n         \n```\n\n\nSee the complete overview on [Codacy](https://app.codacy.com/app/Serenity/Serenity/pullRequest?prid=1542327&bid=7054087)\n        "}}
{"actor":{"display_login":"codacy-bot"}}