Skip to content

Commit f62a054

Browse files
authored
Add Unavailabilities to User seeding (#3069)
1 parent 9200b31 commit f62a054

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

dbschema/seeds/004.users.edgeql

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ with
6363
"major": "Arboriculture",
6464
"institution": "Shire University"
6565
}
66+
],
67+
"unavailabilities": [
68+
{
69+
"description": "Adventure year of saving Middle Earth",
70+
"start": "2021-01-01",
71+
"end": "2021-01-31"
72+
},
73+
{
74+
"description": "Getting the garden back in order after the adventure",
75+
"start": "2022-01-01",
76+
"end": "2022-02-15"
77+
}
6678
]
6779
},
6880
{
@@ -113,6 +125,13 @@ with
113125
"major": "Swordsmanship",
114126
"institution": "Rivendell University"
115127
}
128+
],
129+
"unavailabilities": [
130+
{
131+
"description": "Striding in the wilderness",
132+
"start": "2018-01-01",
133+
"end": "2018-09-30"
134+
}
116135
]
117136
}
118137
]'),
@@ -137,6 +156,15 @@ with
137156
institution := <str>edu['institution']
138157
}
139158
)
159+
),
160+
unavailabilities := (
161+
for unavailability in json_array_unpack(json_get(user, 'unavailabilities'))
162+
union (
163+
insert User::Unavailability {
164+
description := <str>unavailability['description'],
165+
dates := range(<cal::local_date>unavailability['start'], <cal::local_date>unavailability['end'])
166+
}
167+
)
140168
)
141169
})
142170
)

0 commit comments

Comments
 (0)