parent
8f54d68124
commit
4ba1a0f340
@ -0,0 +1,19 @@ |
|||||||
|
export interface HalResourceLink { |
||||||
|
href:string; |
||||||
|
title:string; |
||||||
|
} |
||||||
|
|
||||||
|
/* |
||||||
|
* TODO: This typing is not perfect, since overriding with more specific keys that are optional |
||||||
|
* e.g. `project?:HalResourceLink;` is not possible. This would result in a possible undefined type. |
||||||
|
* I'm not sure how to fix this, but it works for now. |
||||||
|
*/ |
||||||
|
export type HalResourceLinks = Record<string, HalResourceLink|HalResourceLink[]>; |
||||||
|
|
||||||
|
export type CustomTextFormat = 'markdown'|'custom'; |
||||||
|
|
||||||
|
export interface CustomText { |
||||||
|
format:CustomTextFormat; |
||||||
|
raw:string; |
||||||
|
html:string; |
||||||
|
} |
@ -1,20 +1,32 @@ |
|||||||
import { ID } from '@datorama/akita'; |
import { ID } from '@datorama/akita'; |
||||||
|
import { |
||||||
|
HalResourceLink, |
||||||
|
HalResourceLinks, |
||||||
|
CustomText, |
||||||
|
} from 'core-app/core/state/hal-resource'; |
||||||
|
|
||||||
export interface HalResourceLink { |
|
||||||
href:string; |
|
||||||
title:string; |
|
||||||
} |
|
||||||
export const PROJECTS_MAX_SIZE = 100; |
export const PROJECTS_MAX_SIZE = 100; |
||||||
|
|
||||||
|
export interface ProjectHalResourceLinks extends HalResourceLinks { |
||||||
|
categories:HalResourceLink; |
||||||
|
delete:HalResourceLink; |
||||||
|
parent:HalResourceLink; |
||||||
|
self:HalResourceLink; |
||||||
|
status:HalResourceLink; |
||||||
|
schema:HalResourceLink; |
||||||
|
} |
||||||
|
|
||||||
export interface Project { |
export interface Project { |
||||||
id:ID; |
id:ID; |
||||||
|
identifier:string; |
||||||
|
name:string; |
||||||
|
public:boolean; |
||||||
|
active:boolean; |
||||||
|
statusExplanation:CustomText; |
||||||
|
description:CustomText; |
||||||
|
|
||||||
createdAt:string; |
createdAt:string; |
||||||
updatedAt:string; |
updatedAt:string; |
||||||
|
|
||||||
_links:{ |
_links:ProjectHalResourceLinks; |
||||||
actor?:HalResourceLink, |
|
||||||
project?:HalResourceLink, |
|
||||||
resource?:HalResourceLink, |
|
||||||
activity?:HalResourceLink, |
|
||||||
}; |
|
||||||
} |
} |
||||||
|
@ -1,4 +1,4 @@ |
|||||||
export default function idFromLink(href:string|null):string { |
export default function idFromLink(href:string|null):number { |
||||||
const idPart = (href || '').split('/').pop()!; |
const idPart = (href || '').split('/').pop()!; |
||||||
return decodeURIComponent(idPart); |
return parseInt(decodeURIComponent(idPart), 10); |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue