Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions db/gen/accomodation-for-hospitality-panel.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 23 additions & 17 deletions db/queries/accomodation-for-hospitality-panel.sql
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
-- name: GetAllAccommodationRequestsQuery :many
SELECT
id,
name,
email,
phone_number,
college_name,
college_roll_number,
is_male,
room_preference,
payment_status,
'RESERVED' AS check_in_status,
'No Hostel Allotted' AS hostel,
check_in::date as check_in_date,
to_char(check_in, 'HH12:MI AM') as check_in_time,
check_out::date as check_out_date,
to_char(check_out, 'HH12:MI AM') as check_out_time
FROM accomodation_details
ORDER BY created_at DESC;
ad.id,
ad.name,
ad.email,
ad.phone_number,
ad.college_name,
ad.college_roll_number,
ad.is_male,
ad.room_preference,
ad.payment_status,
CASE
WHEN hci.checked_out_at IS NOT NULL THEN 'OUT'
WHEN hci.checked_in_at IS NOT NULL THEN 'IN'
ELSE 'RESERVED'
END AS check_in_status,
COALESCE(hm.hostel_name, 'No Hostel Allocated') AS hostel_name,
ad.check_in::date as check_in_date,
to_char(ad.check_in, 'HH12:MI AM') as check_in_time,
ad.check_out::date as check_out_date,
to_char(ad.check_out, 'HH12:MI AM') as check_out_time
FROM accomodation_details ad
LEFT JOIN hostel_check_in hci ON hci.accomodation_id = ad.id
LEFT JOIN hostel_metadata hm ON ad.hostel_id = hm.id
ORDER BY ad.created_at DESC;

-- name: AddHostelQuery :one
INSERT INTO hostel_metadata (
Expand Down