Fix/events from caldav not taken into consideration when checking availability (#637)
* use version 1.0.6 * use logger over console log fix typing issue Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
This commit is contained in:
		
							parent
							
								
									2cf02c4f31
								
							
						
					
					
						commit
						ed8241ac1b
					
				
					 3 changed files with 57 additions and 56 deletions
				
			
		|  | @ -17,7 +17,7 @@ import { v4 as uuidv4 } from "uuid"; | |||
| import { stripHtml } from "../../emails/helpers"; | ||||
| import logger from "@lib/logger"; | ||||
| 
 | ||||
| const log = logger.getChildLogger({ prefix: ["[[lib] caldav"] }); | ||||
| const log = logger.getChildLogger({ prefix: ["[lib] caldav"] }); | ||||
| 
 | ||||
| type EventBusyDate = Record<"start" | "end", Date>; | ||||
| 
 | ||||
|  | @ -111,7 +111,7 @@ export class CalDavCalendar implements CalendarApiAdapter { | |||
|         id: uid, | ||||
|       }; | ||||
|     } catch (reason) { | ||||
|       console.error(reason); | ||||
|       log.error(reason); | ||||
|       throw reason; | ||||
|     } | ||||
|   } | ||||
|  | @ -161,7 +161,7 @@ export class CalDavCalendar implements CalendarApiAdapter { | |||
|         }) | ||||
|       ); | ||||
|     } catch (reason) { | ||||
|       console.error(reason); | ||||
|       log.error(reason); | ||||
|       throw reason; | ||||
|     } | ||||
|   } | ||||
|  | @ -193,7 +193,7 @@ export class CalDavCalendar implements CalendarApiAdapter { | |||
|         }) | ||||
|       ); | ||||
|     } catch (reason) { | ||||
|       console.error(reason); | ||||
|       log.error(reason); | ||||
|       throw reason; | ||||
|     } | ||||
|   } | ||||
|  | @ -260,7 +260,7 @@ export class CalDavCalendar implements CalendarApiAdapter { | |||
|           integration: this.integrationName, | ||||
|         })); | ||||
|     } catch (reason) { | ||||
|       console.error(reason); | ||||
|       log.error(reason); | ||||
|       throw reason; | ||||
|     } | ||||
|   } | ||||
|  | @ -281,10 +281,11 @@ export class CalDavCalendar implements CalendarApiAdapter { | |||
|         headers: this.headers, | ||||
|       }); | ||||
| 
 | ||||
|       const events = | ||||
|         objects && | ||||
|         objects?.length > 0 && | ||||
|         objects | ||||
|       if (!objects || objects?.length === 0) { | ||||
|         return []; | ||||
|       } | ||||
| 
 | ||||
|       const events = objects | ||||
|         .map((object) => { | ||||
|           if (object?.data) { | ||||
|             const jcalData = ICAL.parse(object.data); | ||||
|  | @ -332,7 +333,7 @@ export class CalDavCalendar implements CalendarApiAdapter { | |||
| 
 | ||||
|       return events; | ||||
|     } catch (reason) { | ||||
|       console.error(reason); | ||||
|       log.error(reason); | ||||
|       throw reason; | ||||
|     } | ||||
|   } | ||||
|  |  | |||
|  | @ -63,7 +63,7 @@ | |||
|     "react-select": "^4.3.1", | ||||
|     "react-timezone-select": "^1.0.7", | ||||
|     "short-uuid": "^4.2.0", | ||||
|     "tsdav": "^1.0.6", | ||||
|     "tsdav": "1.0.6", | ||||
|     "tslog": "^3.2.1", | ||||
|     "uuid": "^8.3.2" | ||||
|   }, | ||||
|  |  | |||
|  | @ -7489,10 +7489,10 @@ ts-pnp@^1.1.6: | |||
|   resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" | ||||
|   integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== | ||||
| 
 | ||||
| tsdav@^1.0.6: | ||||
|   version "1.1.0" | ||||
|   resolved "https://registry.yarnpkg.com/tsdav/-/tsdav-1.1.0.tgz#48fe17df07f852ff8dfddf71fae2396e79ed6735" | ||||
|   integrity sha512-Cc/VTFgUC/fOOFkGT/xuwrrIrG0+it7WA5ywNM4QyYWAzXVw+WmbM1pr7/7fzHA/OOVQ0a8RyPi4K1C+mFBGJw== | ||||
| tsdav@1.0.6: | ||||
|   version "1.0.6" | ||||
|   resolved "https://registry.yarnpkg.com/tsdav/-/tsdav-1.0.6.tgz#65c22fc77d6516db234c1288ff9c9fed6730fef5" | ||||
|   integrity sha512-xnKE39wZtyLoyW1UClYAb2Eilx6tHzbqhO2v29P1zrmwLAsKNYUHwHb+lrmJHfZZLsbbzKWRg5dPLYRuEXmMJA== | ||||
|   dependencies: | ||||
|     base-64 "^1.0.0" | ||||
|     cross-fetch "^3.1.4" | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Femi Odugbesan
						Femi Odugbesan