소스 검색

Minor check

Samson Mutunga 1 년 전
부모
커밋
18ea2090ba
2개의 변경된 파일1개의 추가작업 그리고 14개의 파일을 삭제
  1. 0 13
      app/Http/Controllers/CREATE OR REPLACE VIEW dna_patient_list .sql
  2. 1 1
      app/Providers/TelescopeServiceProvider.php

+ 0 - 13
app/Http/Controllers/CREATE OR REPLACE VIEW dna_patient_list .sql

@@ -57,12 +57,6 @@ select
     c.most_recent_cellular_weight_value,
     c.next_mcp_appointment_date,
 
-
-    (select content from client_memo where client_id = c.id order by created_at desc LIMIT 1) as last_memo_content,
-    (select category from client_memo where client_id = c.id order by created_at desc LIMIT 1) as last_memo_category,
-    (select name_first||' '||name_last from pro where id = (select client_memo.created_by_pro_id from client_memo where client_id = c.id order by created_at desc LIMIT 1)) as last_memo_created_by_pro_display_name,
-    (select count(*) from note where client_id = c.id and is_cancelled is not true ) as active_notes_count,
-
     nmcpa.status as next_mcp_appointment_status,
     nmcpa.raw_date as next_mcp_appointment_raw_date,
     nmcpa.raw_start_time as next_mcp_appointment_start_time,
@@ -77,13 +71,7 @@ select
 
     c.created_at as client_created_at,
 
-    (creator.name_first||' '||creator.name_last) as creator_display_name,
-
-    (select created_at from client_pro_change where new_pro_id = c.mcp_pro_id and responsibility_type = 'MCP' order by created_at DESC LIMIT 1) as mcp_assigned_on,
-
     (dna.name_first|| ' '||dna.name_last ) as dna_display_name,
-    (SELECT sh.status FROM shipment sh LEFT JOIN supply_order so ON so.shipment_id = sh.id WHERE so.product_id  = 4 AND so.client_id = c.id ORDER BY sh.created_at DESC LIMIT 1) as temparature_gun_delivery_status,
-    (SELECT sh.status FROM shipment sh LEFT JOIN supply_order so ON so.shipment_id = sh.id WHERE so.product_id  = 5 AND so.client_id = c.id ORDER BY sh.created_at DESC LIMIT 1) as oximeter_delivery_status,
 
     (select value from measurement where client_id = c.id AND bdt_measurement_id IS NOT NULL AND ts IS NOT NULL AND is_cellular_zero IS FALSE AND is_active IS TRUE AND label = 'Wt. (lbs.)' order by ts desc LIMIT 1) as last_measurement_of_type_weight,
     (select value from measurement where client_id = c.id AND bdt_measurement_id IS NOT NULL AND ts IS NOT NULL AND is_cellular_zero IS FALSE AND is_active IS TRUE AND label = 'BP' order by ts desc LIMIT 1) as last_measurement_of_type_bp,
@@ -101,5 +89,4 @@ from client c
          left join note mrcn  on mrcn.id = c.most_recent_completed_mcp_note_id
          left join measurement mrwm on mrwm.id = c.most_recent_weight_measurement_id
          left join measurement mrbpm on mrbpm.id = c.most_recent_bp_measurement_id
-         left join pro creator on creator.id = c.created_by_pro_id
          left join pro dna on dna.id = c.default_na_pro_id;

+ 1 - 1
app/Providers/TelescopeServiceProvider.php

@@ -86,7 +86,7 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
         Telescope::auth(function ($request) {
             $sessionKey = request()->cookie('sessionKey');
             $appSession = AppSession::where('session_key', $sessionKey)->where('is_active', true)->first();
-            $authenticated = $sessionKey && $appSession && $appSession->pro && $appSession->pro->pro_type != 'ADMIN';
+            $authenticated = $sessionKey && $appSession && $appSession->pro && $appSession->pro->pro_type == 'ADMIN';
             if (!$authenticated) {
                 return abort(403);
             }