1
- import { Entity , EntityNew , Id , Type , TypeNew } from '@graphprotocol/hypergraph' ;
1
+ import { EntitySchema , Id , Type } from '@graphprotocol/hypergraph' ;
2
2
3
- export class User extends Entity . Class < User > ( 'User' ) ( {
4
- name : Type . String ,
5
- } ) { }
6
-
7
- export class Todo extends Entity . Class < Todo > ( 'Todo' ) ( {
8
- name : Type . String ,
9
- completed : Type . Boolean ,
10
- assignees : Type . Relation ( User ) ,
11
- } ) { }
12
-
13
- export class Todo2 extends Entity . Class < Todo2 > ( 'Todo2' ) ( {
14
- name : Type . String ,
15
- checked : Type . Boolean ,
16
- assignees : Type . Relation ( User ) ,
17
- due : Type . Date ,
18
- amount : Type . Number ,
19
- point : Type . Point ,
20
- website : Type . String ,
21
- } ) { }
22
-
23
- export class JobOffer extends Entity . Class < JobOffer > ( 'JobOffer' ) ( {
24
- name : Type . String ,
25
- salary : Type . Number ,
26
- } ) { }
27
-
28
- export class Company extends Entity . Class < Company > ( 'Company' ) ( {
29
- name : Type . String ,
30
- jobOffers : Type . Relation ( JobOffer ) ,
31
- } ) { }
32
-
33
- export class Event extends Entity . Class < Event > ( 'Event' ) ( {
34
- name : Type . String ,
35
- description : Type . optional ( Type . String ) ,
36
- sponsors : Type . Relation ( Company ) ,
37
- } ) { }
38
-
39
- export class Todo3 extends Entity . Class < Todo3 > ( 'Todo3' ) ( {
40
- name : Type . String ,
41
- completed : Type . Boolean ,
42
- description : Type . String ,
43
- } ) { }
44
-
45
- export const UserNew = EntityNew (
46
- { name : TypeNew . String } ,
3
+ export const User = EntitySchema (
4
+ { name : Type . String } ,
47
5
{
48
6
types : [ Id ( 'bffa181e-a333-495b-949c-57f2831d7eca' ) ] ,
49
7
properties : {
@@ -52,11 +10,11 @@ export const UserNew = EntityNew(
52
10
} ,
53
11
) ;
54
12
55
- export const TodoNew = EntityNew (
13
+ export const Todo = EntitySchema (
56
14
{
57
- name : TypeNew . String ,
58
- completed : TypeNew . Boolean ,
59
- assignees : TypeNew . Relation ( UserNew ) ,
15
+ name : Type . String ,
16
+ completed : Type . Boolean ,
17
+ assignees : Type . Relation ( User ) ,
60
18
} ,
61
19
{
62
20
types : [ Id ( '44fe82a9-e4c2-4330-a395-ce85ed78e421' ) ] ,
@@ -68,10 +26,34 @@ export const TodoNew = EntityNew(
68
26
} ,
69
27
) ;
70
28
71
- export const JobOfferNew = EntityNew (
29
+ export const Todo2 = EntitySchema (
72
30
{
73
- name : TypeNew . String ,
74
- salary : TypeNew . Number ,
31
+ name : Type . String ,
32
+ checked : Type . Boolean ,
33
+ assignees : Type . Relation ( User ) ,
34
+ due : Type . Date ,
35
+ amount : Type . Number ,
36
+ point : Type . Point ,
37
+ website : Type . String ,
38
+ } ,
39
+ {
40
+ types : [ Id ( '210f4e94-234c-49d7-af0f-f3b74fb07650' ) ] ,
41
+ properties : {
42
+ name : Id ( 'e291f4da-632d-4b70-aca8-5c6c01dbf1ca' ) ,
43
+ checked : Id ( 'd1cc82ef-8bde-45f4-b31c-56b6d59279ec' ) ,
44
+ assignees : Id ( '1115e9f8-db2e-41df-8969-c5d34c367c10' ) ,
45
+ due : Id ( '6a28f275-b31c-47bc-83cd-ad416aaa7073' ) ,
46
+ amount : Id ( '0c8219be-e284-4738-bd95-91a1c113c78e' ) ,
47
+ point : Id ( '7f032477-c60e-4c85-a161-019b70db05ca' ) ,
48
+ website : Id ( '75b6a647-5c2b-41e7-92c0-b0a0c9b28b02' ) ,
49
+ } ,
50
+ } ,
51
+ ) ;
52
+
53
+ export const JobOffer = EntitySchema (
54
+ {
55
+ name : Type . String ,
56
+ salary : Type . Number ,
75
57
} ,
76
58
{
77
59
types : [ Id ( 'bffa181e-a333-495b-949c-57f2831d7eca' ) ] ,
@@ -81,3 +63,33 @@ export const JobOfferNew = EntityNew(
81
63
} ,
82
64
} ,
83
65
) ;
66
+
67
+ export const Company = EntitySchema (
68
+ {
69
+ name : Type . String ,
70
+ jobOffers : Type . Relation ( JobOffer ) ,
71
+ } ,
72
+ {
73
+ types : [ Id ( '6c504df5-1a8f-43d1-bf2d-1ef9fa5b08b5' ) ] ,
74
+ properties : {
75
+ name : Id ( 'a126ca53-0c8e-48d5-b888-82c734c38935' ) ,
76
+ jobOffers : Id ( '1203064e-9741-4235-89d4-97f4b22eddfb' ) ,
77
+ } ,
78
+ } ,
79
+ ) ;
80
+
81
+ export const Event = EntitySchema (
82
+ {
83
+ name : Type . String ,
84
+ description : Type . optional ( Type . String ) ,
85
+ sponsors : Type . Relation ( Company ) ,
86
+ } ,
87
+ {
88
+ types : [ Id ( '7f9562d4-034d-4385-bf5c-f02cdebba47a' ) ] ,
89
+ properties : {
90
+ name : Id ( 'a126ca53-0c8e-48d5-b888-82c734c38935' ) ,
91
+ description : Id ( '9b1f76ff-9711-404c-861e-59dc3fa7d037' ) ,
92
+ sponsors : Id ( '6860bfac-f703-4289-b789-972d0aaf3abe' ) ,
93
+ } ,
94
+ } ,
95
+ ) ;
0 commit comments