From 4cc5aad4abfb4c11203bb4afd3f56194483c3feb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:52:53 +0000 Subject: [PATCH 1/6] Initial plan From 35414ba3ce0a697635148c83f76e09344635feac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:57:39 +0000 Subject: [PATCH 2/6] Initial exploration complete Co-authored-by: axymthr <17650429+axymthr@users.noreply.github.com> --- .../src/main/resources/static/main.css | 1144 +++++++++++++++++ 1 file changed, 1144 insertions(+) create mode 100644 web-backend/src/main/resources/static/main.css diff --git a/web-backend/src/main/resources/static/main.css b/web-backend/src/main/resources/static/main.css new file mode 100644 index 0000000..6fb97ec --- /dev/null +++ b/web-backend/src/main/resources/static/main.css @@ -0,0 +1,1144 @@ +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +/* +! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com +*/ + +/* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; + /* 1 */ + border-width: 0; + /* 2 */ + border-style: solid; + /* 2 */ + border-color: #e5e7eb; + /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +5. Use the user's configured `sans` font-feature-settings by default. +6. Use the user's configured `sans` font-variation-settings by default. +7. Disable tap highlights on iOS +*/ + +html, +:host { + line-height: 1.5; + /* 1 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + -moz-tab-size: 4; + /* 3 */ + -o-tab-size: 4; + tab-size: 4; + /* 3 */ + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + /* 4 */ + font-feature-settings: normal; + /* 5 */ + font-variation-settings: normal; + /* 6 */ + -webkit-tap-highlight-color: transparent; + /* 7 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; + /* 1 */ + line-height: inherit; + /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; + /* 1 */ + color: inherit; + /* 2 */ + border-top-width: 1px; + /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font-family by default. +2. Use the user's configured `mono` font-feature-settings by default. +3. Use the user's configured `mono` font-variation-settings by default. +4. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* 1 */ + font-feature-settings: normal; + /* 2 */ + font-variation-settings: normal; + /* 3 */ + font-size: 1em; + /* 4 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; + /* 1 */ + border-color: inherit; + /* 2 */ + border-collapse: collapse; + /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + /* 1 */ + font-feature-settings: inherit; + /* 1 */ + font-variation-settings: inherit; + /* 1 */ + font-size: 100%; + /* 1 */ + font-weight: inherit; + /* 1 */ + line-height: inherit; + /* 1 */ + letter-spacing: inherit; + /* 1 */ + color: inherit; + /* 1 */ + margin: 0; + /* 2 */ + padding: 0; + /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { + -webkit-appearance: button; + /* 1 */ + background-color: transparent; + /* 2 */ + background-image: none; + /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Reset default styling for dialogs. +*/ + +dialog { + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ + +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + /* 1 */ + vertical-align: middle; + /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* Make elements with the HTML hidden attribute stay hidden by default */ + +[hidden]:where(:not([hidden="until-found"])) { + display: none; +} + +.pointer-events-none { + pointer-events: none; +} + +.absolute { + position: absolute; +} + +.relative { + position: relative; +} + +.inset-y-0 { + top: 0px; + bottom: 0px; +} + +.bottom-6 { + bottom: 1.5rem; +} + +.left-0 { + left: 0px; +} + +.left-1\/2 { + left: 50%; +} + +.right-0 { + right: 0px; +} + +.right-4 { + right: 1rem; +} + +.top-\[14px\] { + top: 14px; +} + +.top-\[150px\] { + top: 150px; +} + +.z-10 { + z-index: 10; +} + +.mx-auto { + margin-left: auto; + margin-right: auto; +} + +.mb-1 { + margin-bottom: 0.25rem; +} + +.mb-2 { + margin-bottom: 0.5rem; +} + +.mb-4 { + margin-bottom: 1rem; +} + +.mb-6 { + margin-bottom: 1.5rem; +} + +.mb-8 { + margin-bottom: 2rem; +} + +.ml-2 { + margin-left: 0.5rem; +} + +.mr-2 { + margin-right: 0.5rem; +} + +.mr-4 { + margin-right: 1rem; +} + +.mt-1 { + margin-top: 0.25rem; +} + +.mt-2 { + margin-top: 0.5rem; +} + +.mt-4 { + margin-top: 1rem; +} + +.mt-6 { + margin-top: 1.5rem; +} + +.block { + display: block; +} + +.inline-block { + display: inline-block; +} + +.flex { + display: flex; +} + +.grid { + display: grid; +} + +.hidden { + display: none; +} + +.h-12 { + height: 3rem; +} + +.h-5 { + height: 1.25rem; +} + +.h-\[314px\] { + height: 314px; +} + +.h-\[39px\] { + height: 39px; +} + +.h-\[60px\] { + height: 60px; +} + +.h-\[651px\] { + height: 651px; +} + +.min-h-screen { + min-height: 100vh; +} + +.w-5 { + width: 1.25rem; +} + +.w-\[1139px\] { + width: 1139px; +} + +.w-\[165px\] { + width: 165px; +} + +.w-\[512px\] { + width: 512px; +} + +.w-auto { + width: auto; +} + +.w-full { + width: 100%; +} + +.max-w-2xl { + max-width: 42rem; +} + +.max-w-3xl { + max-width: 48rem; +} + +.max-w-4xl { + max-width: 56rem; +} + +.max-w-md { + max-width: 28rem; +} + +.flex-1 { + flex: 1 1 0%; +} + +.-translate-x-1\/2 { + --tw-translate-x: -50%; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.transform { + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +.animate-spin { + animation: spin 1s linear infinite; +} + +.cursor-not-allowed { + cursor: not-allowed; +} + +.cursor-pointer { + cursor: pointer; +} + +.grid-cols-1 { + grid-template-columns: repeat(1, minmax(0, 1fr)); +} + +.flex-col { + flex-direction: column; +} + +.items-center { + align-items: center; +} + +.justify-center { + justify-content: center; +} + +.justify-between { + justify-content: space-between; +} + +.gap-2 { + gap: 0.5rem; +} + +.gap-4 { + gap: 1rem; +} + +.gap-6 { + gap: 1.5rem; +} + +.gap-8 { + gap: 2rem; +} + +.space-y-4 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1rem * var(--tw-space-y-reverse)); +} + +.rounded { + border-radius: 0.25rem; +} + +.rounded-lg { + border-radius: 0.5rem; +} + +.rounded-md { + border-radius: 0.375rem; +} + +.border { + border-width: 1px; +} + +.border-4 { + border-width: 4px; +} + +.border-b { + border-bottom-width: 1px; +} + +.border-black { + --tw-border-opacity: 1; + border-color: rgb(0 0 0 / var(--tw-border-opacity, 1)); +} + +.border-blue-700 { + --tw-border-opacity: 1; + border-color: rgb(29 78 216 / var(--tw-border-opacity, 1)); +} + +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity, 1)); +} + +.border-gray-300 { + --tw-border-opacity: 1; + border-color: rgb(209 213 219 / var(--tw-border-opacity, 1)); +} + +.bg-black { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1)); +} + +.bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)); +} + +.bg-gray-200 { + --tw-bg-opacity: 1; + background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1)); +} + +.bg-gray-300 { + --tw-bg-opacity: 1; + background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1)); +} + +.bg-transparent { + background-color: transparent; +} + +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)); +} + +.bg-yellow-500 { + --tw-bg-opacity: 1; + background-color: rgb(234 179 8 / var(--tw-bg-opacity, 1)); +} + +.p-4 { + padding: 1rem; +} + +.p-8 { + padding: 2rem; +} + +.px-3 { + padding-left: 0.75rem; + padding-right: 0.75rem; +} + +.px-4 { + padding-left: 1rem; + padding-right: 1rem; +} + +.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.pb-2 { + padding-bottom: 0.5rem; +} + +.pl-10 { + padding-left: 2.5rem; +} + +.pl-3 { + padding-left: 0.75rem; +} + +.pl-4 { + padding-left: 1rem; +} + +.pr-3 { + padding-right: 0.75rem; +} + +.text-center { + text-align: center; +} + +.font-sans { + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; +} + +.text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} + +.text-3xl { + font-size: 1.875rem; + line-height: 2.25rem; +} + +.text-4xl { + font-size: 2.25rem; + line-height: 2.5rem; +} + +.text-lg { + font-size: 1.125rem; + line-height: 1.75rem; +} + +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + +.font-bold { + font-weight: 700; +} + +.font-medium { + font-weight: 500; +} + +.font-semibold { + font-weight: 600; +} + +.leading-relaxed { + line-height: 1.625; +} + +.text-black { + --tw-text-opacity: 1; + color: rgb(0 0 0 / var(--tw-text-opacity, 1)); +} + +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity, 1)); +} + +.text-gray-500 { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity, 1)); +} + +.text-gray-600 { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity, 1)); +} + +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity, 1)); +} + +.text-gray-800 { + --tw-text-opacity: 1; + color: rgb(31 41 55 / var(--tw-text-opacity, 1)); +} + +.text-red-600 { + --tw-text-opacity: 1; + color: rgb(220 38 38 / var(--tw-text-opacity, 1)); +} + +.text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity, 1)); +} + +.opacity-25 { + opacity: 0.25; +} + +.opacity-75 { + opacity: 0.75; +} + +.shadow-lg { + --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.shadow-md { + --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.shadow-sm { + --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); + --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.invert { + --tw-invert: invert(100%); + filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); +} + +.filter { + filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); +} + +.hover\:bg-gray-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)); +} + +.hover\:bg-gray-300:hover { + --tw-bg-opacity: 1; + background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1)); +} + +.hover\:bg-gray-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1)); +} + +.hover\:bg-yellow-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(202 138 4 / var(--tw-bg-opacity, 1)); +} + +.focus\:border-indigo-300:focus { + --tw-border-opacity: 1; + border-color: rgb(165 180 252 / var(--tw-border-opacity, 1)); +} + +.focus\:outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus\:ring:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-2:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-blue-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1)); +} + +.focus\:ring-gray-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity, 1)); +} + +.focus\:ring-indigo-200:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(199 210 254 / var(--tw-ring-opacity, 1)); +} + +.focus\:ring-yellow-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(234 179 8 / var(--tw-ring-opacity, 1)); +} + +.focus\:ring-opacity-50:focus { + --tw-ring-opacity: 0.5; +} + +.focus\:ring-offset-2:focus { + --tw-ring-offset-width: 2px; +} + +@media (min-width: 768px) { + .md\:grid-cols-2 { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} \ No newline at end of file From 66c4efe63d02fbcf0f79c0011c1eac6fe9fb6a19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 12:03:05 +0000 Subject: [PATCH 3/6] Add optional SQLite persistence layer (disabled by default) Co-authored-by: axymthr <17650429+axymthr@users.noreply.github.com> --- web-backend/README.md | 3 +- .../adr/0004-optional-sqlite-persistence.md | 90 +++++++++ web-backend/docs/sqlite-persistence.md | 190 ++++++++++++++++++ web-backend/pom.xml | 9 + .../statusneo/vms/config/SQLiteConfig.java | 51 +++++ .../src/main/resources/application-sqlite.yml | 20 ++ .../vms/config/SQLiteConfigTest.java | 71 +++++++ web-backend/vms.db | Bin 0 -> 20480 bytes 8 files changed, 433 insertions(+), 1 deletion(-) create mode 100644 web-backend/docs/adr/0004-optional-sqlite-persistence.md create mode 100644 web-backend/docs/sqlite-persistence.md create mode 100644 web-backend/src/main/java/com/statusneo/vms/config/SQLiteConfig.java create mode 100644 web-backend/src/main/resources/application-sqlite.yml create mode 100644 web-backend/src/test/java/com/statusneo/vms/config/SQLiteConfigTest.java create mode 100644 web-backend/vms.db diff --git a/web-backend/README.md b/web-backend/README.md index 12e9455..18b603a 100644 --- a/web-backend/README.md +++ b/web-backend/README.md @@ -29,11 +29,12 @@ Check out the [docs](docs/) and [ADRs](docs/adr/README.md) The project uses Spring Boot 3.4.5 with the following key configurations: 1. **Database**: PostgreSQL is used as the primary database + - **Optional**: SQLite can be used for development/testing (see [SQLite Persistence](docs/sqlite-persistence.md)) 2. **Template Engine**: JTE (Java Template Engine) is used for HTML templates 3. **Authentication**: Azure AD integration via Spring Security OAuth2 4. **File Upload**: Apache POI for Excel file handling -Required environment variables: +Required environment variables (for PostgreSQL): - `SPRING_DATASOURCE_URL`: Database connection URL - `SPRING_DATASOURCE_USERNAME`: Database username - `SPRING_DATASOURCE_PASSWORD`: Database password diff --git a/web-backend/docs/adr/0004-optional-sqlite-persistence.md b/web-backend/docs/adr/0004-optional-sqlite-persistence.md new file mode 100644 index 0000000..1ce6234 --- /dev/null +++ b/web-backend/docs/adr/0004-optional-sqlite-persistence.md @@ -0,0 +1,90 @@ +# Architecture Decision Record + +## Title +Add Optional SQLite Persistence Layer + +## Status +Accepted + +## Context +While PostgreSQL with JPA is the primary production database, there are scenarios where developers and testers may benefit from a lightweight, file-based database option: + +1. **Quick Local Development**: Developers can run the application without setting up PostgreSQL +2. **Simplified Testing**: Integration tests can use SQLite without Docker/TestContainers overhead +3. **Demos and Prototyping**: Easier to share and demonstrate features without infrastructure setup +4. **CI/CD Optimization**: Faster builds in certain scenarios + +However, SQLite has limitations: +- Limited concurrency support +- No advanced PostgreSQL-specific features (JSONB, advanced indexing) +- Different SQL dialect quirks +- Not suitable for production workloads + +## Decision +We will add an optional SQLite persistence layer that: + +1. **Remains Disabled by Default**: PostgreSQL/JPA remains the default configuration +2. **Profile-Based Activation**: SQLite is enabled via Spring profile (`sqlite`) AND a specific property (`vms.persistence.sqlite.enabled=true`) +3. **Maintains JPA Compatibility**: Uses the same JPA entities and repositories +4. **Leverages Hibernate Community Dialects**: Uses `org.hibernate.community.dialect.SQLiteDialect` +5. **Disables Flyway**: SQLite relies on Hibernate's DDL auto-generation instead of migrations + +## Implementation Details + +### Dependencies +- `sqlite-jdbc` (3.47.2.0): JDBC driver for SQLite +- `hibernate-community-dialects`: Provides SQLite dialect for Hibernate + +### Configuration +- Profile: `sqlite` in `application-sqlite.yml` +- Property gate: `vms.persistence.sqlite.enabled=true` +- Database file: `vms.db` (created in working directory) +- Hibernate DDL: `update` mode (auto-create/update schema) + +### Activation +To use SQLite, both conditions must be met: +1. Profile: `--spring.profiles.active=sqlite` +2. Property: `vms.persistence.sqlite.enabled=true` + +Example: +```bash +./mvnw spring-boot:run -Dspring-boot.run.profiles=sqlite -Dspring-boot.run.arguments="--vms.persistence.sqlite.enabled=true" +``` + +## Consequences + +### Positive +- Developers can quickly test without PostgreSQL setup +- Simpler demo and prototyping scenarios +- Potential CI/CD time savings for certain test scenarios +- Maintains full JPA compatibility (same entities and repositories work) + +### Negative +- Additional dependency to maintain +- SQLite behavior differences may mask PostgreSQL-specific issues +- Developers might accidentally develop against SQLite instead of production DB +- Requires explicit double opt-in to prevent accidental usage + +### Neutral +- Configuration complexity slightly increased +- Need to ensure production deployments never accidentally enable SQLite + +## Alternatives Considered + +### H2 Database +- **Pro**: More commonly used in Spring Boot projects, better PostgreSQL compatibility mode +- **Con**: Heavier weight than SQLite, still has dialect differences + +### TestContainers Only +- **Pro**: Exact PostgreSQL match, no dialect issues +- **Con**: Requires Docker, slower startup, more complex setup + +### Keep PostgreSQL Only +- **Pro**: Single database to support, no dialect confusion +- **Con**: Higher barrier to entry for new developers, slower local development setup + +## Notes +- SQLite is **NOT** for production use +- All CI/CD production tests should continue using PostgreSQL via TestContainers +- This option is primarily for developer convenience and specific testing scenarios +- Production configuration remains unchanged (PostgreSQL/JPA) diff --git a/web-backend/docs/sqlite-persistence.md b/web-backend/docs/sqlite-persistence.md new file mode 100644 index 0000000..02b273b --- /dev/null +++ b/web-backend/docs/sqlite-persistence.md @@ -0,0 +1,190 @@ +# SQLite Persistence Layer + +## Overview +This directory contains documentation for the optional SQLite persistence layer for the VMS application. SQLite is provided as an alternative to PostgreSQL for development, testing, and demonstration purposes. + +## ⚠️ Important Notice +**SQLite is NOT intended for production use.** PostgreSQL with JPA remains the primary and recommended database for all production environments. + +## When to Use SQLite + +### Good Use Cases +- **Quick Local Development**: Testing features without PostgreSQL setup +- **Simple Demos**: Demonstrating functionality with minimal infrastructure +- **Unit/Integration Testing**: Faster tests without Docker overhead +- **Prototyping**: Rapid experimentation with new features + +### Bad Use Cases +- **Production Deployments**: Never use SQLite in production +- **Performance Testing**: SQLite performance != PostgreSQL performance +- **Concurrent Access**: SQLite has limited concurrency support +- **PostgreSQL-Specific Features**: Testing JSONB, advanced indexes, etc. + +## Enabling SQLite + +### Prerequisites +SQLite is built into the dependencies. No additional installation required. + +### Activation +SQLite requires **both** conditions to be met: + +1. **Spring Profile**: `sqlite` +2. **Configuration Property**: `vms.persistence.sqlite.enabled=true` + +### Option 1: Command Line +```bash +./mvnw spring-boot:run \ + -Dspring-boot.run.profiles=sqlite \ + -Dspring-boot.run.arguments="--vms.persistence.sqlite.enabled=true" +``` + +### Option 2: Environment Variables +```bash +export SPRING_PROFILES_ACTIVE=sqlite +export VMS_PERSISTENCE_SQLITE_ENABLED=true +./mvnw spring-boot:run +``` + +### Option 3: IDE Configuration (IntelliJ IDEA) +1. Edit Run Configuration +2. Set **Active profiles**: `sqlite` +3. Add **VM options** or **Program arguments**: `--vms.persistence.sqlite.enabled=true` +4. Run the application + +### Option 4: Application Properties (Not Recommended) +In `application.yml`: +```yaml +spring: + profiles: + active: sqlite + +vms: + persistence: + sqlite: + enabled: true +``` + +**Warning**: This permanently enables SQLite. Use command line or environment variables instead. + +## Configuration Details + +### Database File +- **Location**: `vms.db` in the working directory (where you run the application) +- **Auto-created**: The file is created automatically on first run +- **Reset**: Delete `vms.db` to reset the database + +### Schema Management +- **Hibernate DDL**: `update` mode (auto-create/update tables) +- **Flyway**: Disabled (SQLite uses Hibernate DDL instead) +- **Migrations**: Not applied in SQLite mode + +### Dialect +- **Hibernate Dialect**: `org.hibernate.community.dialect.SQLiteDialect` +- **JDBC Driver**: `org.sqlite.JDBC` + +## Limitations + +### Functional Limitations +1. **No Concurrent Writes**: SQLite locks the entire database for writes +2. **Limited ALTER TABLE**: Some schema changes require table recreation +3. **No Advanced Features**: No JSONB, advanced indexing, or PostgreSQL extensions +4. **Different SQL Dialect**: Some queries may behave differently + +### Development Considerations +1. **Dialect Differences**: Code that works on SQLite might fail on PostgreSQL +2. **Performance**: SQLite performance is not representative of PostgreSQL +3. **Data Types**: Some type mappings differ between SQLite and PostgreSQL +4. **Transaction Behavior**: Different isolation and locking semantics + +## Switching Back to PostgreSQL + +### Option 1: Remove Profile +Simply run without the `sqlite` profile: +```bash +./mvnw spring-boot:run +``` + +### Option 2: Unset Environment Variables +```bash +unset SPRING_PROFILES_ACTIVE +unset VMS_PERSISTENCE_SQLITE_ENABLED +./mvnw spring-boot:run +``` + +### Verify PostgreSQL is Active +Check the logs on startup: +``` +Hibernate: Using dialect: org.hibernate.dialect.PostgreSQLDialect +``` + +If you see `SQLiteDialect` instead, SQLite is still active. + +## Testing with SQLite + +### Unit Tests +Create a test configuration with SQLite profile: + +```java +@SpringBootTest +@ActiveProfiles("sqlite") +@TestPropertySource(properties = { + "vms.persistence.sqlite.enabled=true" +}) +class MyServiceTest { + // Tests here +} +``` + +### Integration Tests +For true integration testing, prefer TestContainers with PostgreSQL: +```java +@SpringBootTest +@Testcontainers +@Import(TestcontainersConfiguration.class) +class MyIntegrationTest { + // Tests with actual PostgreSQL +} +``` + +## Troubleshooting + +### SQLite Not Activating +**Problem**: Application still uses PostgreSQL + +**Solutions**: +1. Verify both profile AND property are set +2. Check logs for: `Using dialect: SQLiteDialect` +3. Ensure no conflicting datasource configuration + +### "Database Locked" Errors +**Problem**: `SQLiteException: database is locked` + +**Solutions**: +1. Close other connections to `vms.db` +2. Stop other running instances of the application +3. Delete `vms.db` and restart (loses data) +4. SQLite may not be suitable for your concurrency needs + +### Schema Issues +**Problem**: Tables not created or migrations failing + +**Solutions**: +1. Verify Flyway is disabled (should be in `application-sqlite.yml`) +2. Check Hibernate DDL is set to `update` +3. Delete `vms.db` to recreate schema from scratch +4. SQLite has limited ALTER TABLE support - may need to recreate tables + +### Switching Between Databases +**Problem**: Data not visible after switching + +**Remember**: +- PostgreSQL data is in PostgreSQL (Docker/remote server) +- SQLite data is in `vms.db` file +- They are separate databases with separate data + +## Architecture Decision Record +For the full rationale and decision details, see: +[ADR-0004: Optional SQLite Persistence](../docs/adr/0004-optional-sqlite-persistence.md) + +## Support +SQLite support is provided as-is for development convenience. For production issues, always test against PostgreSQL first. diff --git a/web-backend/pom.xml b/web-backend/pom.xml index 7a9d37c..3e039eb 100644 --- a/web-backend/pom.xml +++ b/web-backend/pom.xml @@ -131,6 +131,15 @@ postgresql runtime + + org.xerial + sqlite-jdbc + 3.47.2.0 + + + org.hibernate.orm + hibernate-community-dialects + org.springframework.boot spring-boot-starter-test diff --git a/web-backend/src/main/java/com/statusneo/vms/config/SQLiteConfig.java b/web-backend/src/main/java/com/statusneo/vms/config/SQLiteConfig.java new file mode 100644 index 0000000..6c78b04 --- /dev/null +++ b/web-backend/src/main/java/com/statusneo/vms/config/SQLiteConfig.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.statusneo.vms.config; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +/** + * Configuration class for SQLite persistence layer. + * This configuration is only active when the 'sqlite' profile is enabled. + * + * To enable SQLite persistence: + * - Set spring.profiles.active=sqlite in application.yml, or + * - Use --spring.profiles.active=sqlite as a command line argument, or + * - Set SPRING_PROFILES_ACTIVE=sqlite as an environment variable + * + * Note: SQLite is intended for development and testing purposes. + * For production, PostgreSQL with JPA should be used. + */ +@Configuration +@Profile("sqlite") +@ConditionalOnProperty(name = "vms.persistence.sqlite.enabled", havingValue = "true", matchIfMissing = false) +public class SQLiteConfig { + + /** + * Default constructor. + * This configuration class uses Spring Boot auto-configuration + * with the settings from application-sqlite.yml. + */ + public SQLiteConfig() { + // SQLite configuration is driven by application-sqlite.yml + // This class serves as a marker for the SQLite profile + } +} diff --git a/web-backend/src/main/resources/application-sqlite.yml b/web-backend/src/main/resources/application-sqlite.yml new file mode 100644 index 0000000..31741a1 --- /dev/null +++ b/web-backend/src/main/resources/application-sqlite.yml @@ -0,0 +1,20 @@ +spring: + datasource: + url: jdbc:sqlite:vms.db + driver-class-name: org.sqlite.JDBC + username: + password: + jpa: + database-platform: org.hibernate.community.dialect.SQLiteDialect + hibernate: + ddl-auto: update + show-sql: true + properties: + hibernate: + format_sql: true + flyway: + enabled: false + +# SQLite does not require Flyway migrations since schema is managed by Hibernate +flyway: + enabled: false diff --git a/web-backend/src/test/java/com/statusneo/vms/config/SQLiteConfigTest.java b/web-backend/src/test/java/com/statusneo/vms/config/SQLiteConfigTest.java new file mode 100644 index 0000000..17201c8 --- /dev/null +++ b/web-backend/src/test/java/com/statusneo/vms/config/SQLiteConfigTest.java @@ -0,0 +1,71 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.statusneo.vms.config; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import java.nio.file.Path; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.DatabaseMetaData; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Unit test to verify SQLite JDBC driver is available and working. + * This test does not require the full Spring context. + */ +class SQLiteConfigTest { + + @Test + void testSQLiteDriverIsAvailable() { + assertDoesNotThrow(() -> { + Class.forName("org.sqlite.JDBC"); + }, "SQLite JDBC driver should be available on classpath"); + } + + @Test + void testCanConnectToSQLite(@TempDir Path tempDir) throws Exception { + String dbPath = tempDir.resolve("test.db").toString(); + String jdbcUrl = "jdbc:sqlite:" + dbPath; + + try (Connection connection = DriverManager.getConnection(jdbcUrl)) { + assertNotNull(connection, "Should be able to create SQLite connection"); + + DatabaseMetaData metaData = connection.getMetaData(); + assertEquals("SQLite", metaData.getDatabaseProductName(), + "Database product should be SQLite"); + } + } + + @Test + void testSQLiteDialectIsAvailable() { + assertDoesNotThrow(() -> { + Class.forName("org.hibernate.community.dialect.SQLiteDialect"); + }, "Hibernate SQLite dialect should be available on classpath"); + } + + @Test + void testSQLiteConfigClassExists() { + assertDoesNotThrow(() -> { + Class.forName("com.statusneo.vms.config.SQLiteConfig"); + }, "SQLiteConfig class should exist"); + } +} diff --git a/web-backend/vms.db b/web-backend/vms.db new file mode 100644 index 0000000000000000000000000000000000000000..60b33093dc5db1b1c0172914ec494d0e5902bf8d GIT binary patch literal 20480 zcmeI#&uiN-6bEp-bqS3A81&#mY0)u(GT27%>)NnOFa2>Sy9gzIZNzLz$VzA~g{J+( zCwq2HXxx_3LkV9IBS)4ay^mfF@8axKI%3z_X2P-W!RH_hgCC3qK@jB z!usZgJ_^3v{oe2sqV>&Si*KH6T=^R`2tWV=5P$##AOHafK;Q!i%zj0kcy~8^Bqs(b zO=K>ewpF)weBM90?6b?GpQn9R4YKYhRyCP0sT|#qJ$M=uNn$C_*+kgkNZ9VT!^2+l zbZAL9O1Q5)oXjY9A~Q^B$J97Yn`x8@nYR3d5*f8TG9#^st8q3UJ2z#)5=IW)*b+Cw zjppVyyBO)*aUbJA-uN(^absmB?3DeXDeKClSH|AEm#dvPj>Ctqjbup{Jy(3iuvoZd zPcrAi7^^4b_oa18LNy!H&a}K%ZiFY^zHx8ft4{XqvCei@I`Q^)_!yV5`gQ$hbuP|g zFE3}xJLCf08fk@-TJa*C7RAukNb4c~*D^maacUYLGMQ!ejel!R`00Izz00bZa0SG_<0uX=z1eRC;_5TtdE<%F< z1Rwwb2tWV=5P$##AOHafR062~kqQui00bZa0SG_<0uX=z1Rwx`BLjV8( literal 0 HcmV?d00001 From fa9b500a7a853acc50c8f70ab817a1850a63e588 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 12:03:46 +0000 Subject: [PATCH 4/6] Add SQLite database files to .gitignore Co-authored-by: axymthr <17650429+axymthr@users.noreply.github.com> --- web-backend/.gitignore | 6 ++++++ web-backend/vms.db | Bin 20480 -> 0 bytes 2 files changed, 6 insertions(+) delete mode 100644 web-backend/vms.db diff --git a/web-backend/.gitignore b/web-backend/.gitignore index b2cd2a4..2302418 100644 --- a/web-backend/.gitignore +++ b/web-backend/.gitignore @@ -16,3 +16,9 @@ local.properties google-services.json target /src/main/frontend/node_modules/ + +# SQLite database files +*.db +*.db-journal +*.db-wal +*.db-shm diff --git a/web-backend/vms.db b/web-backend/vms.db deleted file mode 100644 index 60b33093dc5db1b1c0172914ec494d0e5902bf8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeI#&uiN-6bEp-bqS3A81&#mY0)u(GT27%>)NnOFa2>Sy9gzIZNzLz$VzA~g{J+( zCwq2HXxx_3LkV9IBS)4ay^mfF@8axKI%3z_X2P-W!RH_hgCC3qK@jB z!usZgJ_^3v{oe2sqV>&Si*KH6T=^R`2tWV=5P$##AOHafK;Q!i%zj0kcy~8^Bqs(b zO=K>ewpF)weBM90?6b?GpQn9R4YKYhRyCP0sT|#qJ$M=uNn$C_*+kgkNZ9VT!^2+l zbZAL9O1Q5)oXjY9A~Q^B$J97Yn`x8@nYR3d5*f8TG9#^st8q3UJ2z#)5=IW)*b+Cw zjppVyyBO)*aUbJA-uN(^absmB?3DeXDeKClSH|AEm#dvPj>Ctqjbup{Jy(3iuvoZd zPcrAi7^^4b_oa18LNy!H&a}K%ZiFY^zHx8ft4{XqvCei@I`Q^)_!yV5`gQ$hbuP|g zFE3}xJLCf08fk@-TJa*C7RAukNb4c~*D^maacUYLGMQ!ejel!R`00Izz00bZa0SG_<0uX=z1eRC;_5TtdE<%F< z1Rwwb2tWV=5P$##AOHafR062~kqQui00bZa0SG_<0uX=z1Rwx`BLjV8( From 0bcd53e4fcaf7c9a69a2e5a585df32c5bb0c28cf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 18:23:08 +0000 Subject: [PATCH 5/6] Remove build artifact main.css from PR and add to .gitignore Co-authored-by: axymthr <17650429+axymthr@users.noreply.github.com> --- web-backend/.gitignore | 3 + .../src/main/resources/static/main.css | 1144 ----------------- 2 files changed, 3 insertions(+), 1144 deletions(-) delete mode 100644 web-backend/src/main/resources/static/main.css diff --git a/web-backend/.gitignore b/web-backend/.gitignore index 2302418..e4cb033 100644 --- a/web-backend/.gitignore +++ b/web-backend/.gitignore @@ -17,6 +17,9 @@ google-services.json target /src/main/frontend/node_modules/ +# Generated CSS from Tailwind build +/src/main/resources/static/main.css + # SQLite database files *.db *.db-journal diff --git a/web-backend/src/main/resources/static/main.css b/web-backend/src/main/resources/static/main.css deleted file mode 100644 index 6fb97ec..0000000 --- a/web-backend/src/main/resources/static/main.css +++ /dev/null @@ -1,1144 +0,0 @@ -*, ::before, ::after { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -::backdrop { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -/* -! tailwindcss v3.4.18 | MIT License | https://tailwindcss.com -*/ - -/* -1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) -2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) -*/ - -*, -::before, -::after { - box-sizing: border-box; - /* 1 */ - border-width: 0; - /* 2 */ - border-style: solid; - /* 2 */ - border-color: #e5e7eb; - /* 2 */ -} - -::before, -::after { - --tw-content: ''; -} - -/* -1. Use a consistent sensible line-height in all browsers. -2. Prevent adjustments of font size after orientation changes in iOS. -3. Use a more readable tab size. -4. Use the user's configured `sans` font-family by default. -5. Use the user's configured `sans` font-feature-settings by default. -6. Use the user's configured `sans` font-variation-settings by default. -7. Disable tap highlights on iOS -*/ - -html, -:host { - line-height: 1.5; - /* 1 */ - -webkit-text-size-adjust: 100%; - /* 2 */ - -moz-tab-size: 4; - /* 3 */ - -o-tab-size: 4; - tab-size: 4; - /* 3 */ - font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; - /* 4 */ - font-feature-settings: normal; - /* 5 */ - font-variation-settings: normal; - /* 6 */ - -webkit-tap-highlight-color: transparent; - /* 7 */ -} - -/* -1. Remove the margin in all browsers. -2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. -*/ - -body { - margin: 0; - /* 1 */ - line-height: inherit; - /* 2 */ -} - -/* -1. Add the correct height in Firefox. -2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) -3. Ensure horizontal rules are visible by default. -*/ - -hr { - height: 0; - /* 1 */ - color: inherit; - /* 2 */ - border-top-width: 1px; - /* 3 */ -} - -/* -Add the correct text decoration in Chrome, Edge, and Safari. -*/ - -abbr:where([title]) { - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; -} - -/* -Remove the default font size and weight for headings. -*/ - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: inherit; - font-weight: inherit; -} - -/* -Reset links to optimize for opt-in styling instead of opt-out. -*/ - -a { - color: inherit; - text-decoration: inherit; -} - -/* -Add the correct font weight in Edge and Safari. -*/ - -b, -strong { - font-weight: bolder; -} - -/* -1. Use the user's configured `mono` font-family by default. -2. Use the user's configured `mono` font-feature-settings by default. -3. Use the user's configured `mono` font-variation-settings by default. -4. Correct the odd `em` font sizing in all browsers. -*/ - -code, -kbd, -samp, -pre { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - /* 1 */ - font-feature-settings: normal; - /* 2 */ - font-variation-settings: normal; - /* 3 */ - font-size: 1em; - /* 4 */ -} - -/* -Add the correct font size in all browsers. -*/ - -small { - font-size: 80%; -} - -/* -Prevent `sub` and `sup` elements from affecting the line height in all browsers. -*/ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* -1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) -2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) -3. Remove gaps between table borders by default. -*/ - -table { - text-indent: 0; - /* 1 */ - border-color: inherit; - /* 2 */ - border-collapse: collapse; - /* 3 */ -} - -/* -1. Change the font styles in all browsers. -2. Remove the margin in Firefox and Safari. -3. Remove default padding in all browsers. -*/ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; - /* 1 */ - font-feature-settings: inherit; - /* 1 */ - font-variation-settings: inherit; - /* 1 */ - font-size: 100%; - /* 1 */ - font-weight: inherit; - /* 1 */ - line-height: inherit; - /* 1 */ - letter-spacing: inherit; - /* 1 */ - color: inherit; - /* 1 */ - margin: 0; - /* 2 */ - padding: 0; - /* 3 */ -} - -/* -Remove the inheritance of text transform in Edge and Firefox. -*/ - -button, -select { - text-transform: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Remove default button styles. -*/ - -button, -input:where([type='button']), -input:where([type='reset']), -input:where([type='submit']) { - -webkit-appearance: button; - /* 1 */ - background-color: transparent; - /* 2 */ - background-image: none; - /* 2 */ -} - -/* -Use the modern Firefox focus style for all focusable elements. -*/ - -:-moz-focusring { - outline: auto; -} - -/* -Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) -*/ - -:-moz-ui-invalid { - box-shadow: none; -} - -/* -Add the correct vertical alignment in Chrome and Firefox. -*/ - -progress { - vertical-align: baseline; -} - -/* -Correct the cursor style of increment and decrement buttons in Safari. -*/ - -::-webkit-inner-spin-button, -::-webkit-outer-spin-button { - height: auto; -} - -/* -1. Correct the odd appearance in Chrome and Safari. -2. Correct the outline style in Safari. -*/ - -[type='search'] { - -webkit-appearance: textfield; - /* 1 */ - outline-offset: -2px; - /* 2 */ -} - -/* -Remove the inner padding in Chrome and Safari on macOS. -*/ - -::-webkit-search-decoration { - -webkit-appearance: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Change font properties to `inherit` in Safari. -*/ - -::-webkit-file-upload-button { - -webkit-appearance: button; - /* 1 */ - font: inherit; - /* 2 */ -} - -/* -Add the correct display in Chrome and Safari. -*/ - -summary { - display: list-item; -} - -/* -Removes the default spacing and border for appropriate elements. -*/ - -blockquote, -dl, -dd, -h1, -h2, -h3, -h4, -h5, -h6, -hr, -figure, -p, -pre { - margin: 0; -} - -fieldset { - margin: 0; - padding: 0; -} - -legend { - padding: 0; -} - -ol, -ul, -menu { - list-style: none; - margin: 0; - padding: 0; -} - -/* -Reset default styling for dialogs. -*/ - -dialog { - padding: 0; -} - -/* -Prevent resizing textareas horizontally by default. -*/ - -textarea { - resize: vertical; -} - -/* -1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) -2. Set the default placeholder color to the user's configured gray 400 color. -*/ - -input::-moz-placeholder, textarea::-moz-placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -input::placeholder, -textarea::placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -/* -Set the default cursor for buttons. -*/ - -button, -[role="button"] { - cursor: pointer; -} - -/* -Make sure disabled buttons don't get the pointer cursor. -*/ - -:disabled { - cursor: default; -} - -/* -1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) -2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) - This can trigger a poorly considered lint error in some tools but is included by design. -*/ - -img, -svg, -video, -canvas, -audio, -iframe, -embed, -object { - display: block; - /* 1 */ - vertical-align: middle; - /* 2 */ -} - -/* -Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) -*/ - -img, -video { - max-width: 100%; - height: auto; -} - -/* Make elements with the HTML hidden attribute stay hidden by default */ - -[hidden]:where(:not([hidden="until-found"])) { - display: none; -} - -.pointer-events-none { - pointer-events: none; -} - -.absolute { - position: absolute; -} - -.relative { - position: relative; -} - -.inset-y-0 { - top: 0px; - bottom: 0px; -} - -.bottom-6 { - bottom: 1.5rem; -} - -.left-0 { - left: 0px; -} - -.left-1\/2 { - left: 50%; -} - -.right-0 { - right: 0px; -} - -.right-4 { - right: 1rem; -} - -.top-\[14px\] { - top: 14px; -} - -.top-\[150px\] { - top: 150px; -} - -.z-10 { - z-index: 10; -} - -.mx-auto { - margin-left: auto; - margin-right: auto; -} - -.mb-1 { - margin-bottom: 0.25rem; -} - -.mb-2 { - margin-bottom: 0.5rem; -} - -.mb-4 { - margin-bottom: 1rem; -} - -.mb-6 { - margin-bottom: 1.5rem; -} - -.mb-8 { - margin-bottom: 2rem; -} - -.ml-2 { - margin-left: 0.5rem; -} - -.mr-2 { - margin-right: 0.5rem; -} - -.mr-4 { - margin-right: 1rem; -} - -.mt-1 { - margin-top: 0.25rem; -} - -.mt-2 { - margin-top: 0.5rem; -} - -.mt-4 { - margin-top: 1rem; -} - -.mt-6 { - margin-top: 1.5rem; -} - -.block { - display: block; -} - -.inline-block { - display: inline-block; -} - -.flex { - display: flex; -} - -.grid { - display: grid; -} - -.hidden { - display: none; -} - -.h-12 { - height: 3rem; -} - -.h-5 { - height: 1.25rem; -} - -.h-\[314px\] { - height: 314px; -} - -.h-\[39px\] { - height: 39px; -} - -.h-\[60px\] { - height: 60px; -} - -.h-\[651px\] { - height: 651px; -} - -.min-h-screen { - min-height: 100vh; -} - -.w-5 { - width: 1.25rem; -} - -.w-\[1139px\] { - width: 1139px; -} - -.w-\[165px\] { - width: 165px; -} - -.w-\[512px\] { - width: 512px; -} - -.w-auto { - width: auto; -} - -.w-full { - width: 100%; -} - -.max-w-2xl { - max-width: 42rem; -} - -.max-w-3xl { - max-width: 48rem; -} - -.max-w-4xl { - max-width: 56rem; -} - -.max-w-md { - max-width: 28rem; -} - -.flex-1 { - flex: 1 1 0%; -} - -.-translate-x-1\/2 { - --tw-translate-x: -50%; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.transform { - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -@keyframes spin { - to { - transform: rotate(360deg); - } -} - -.animate-spin { - animation: spin 1s linear infinite; -} - -.cursor-not-allowed { - cursor: not-allowed; -} - -.cursor-pointer { - cursor: pointer; -} - -.grid-cols-1 { - grid-template-columns: repeat(1, minmax(0, 1fr)); -} - -.flex-col { - flex-direction: column; -} - -.items-center { - align-items: center; -} - -.justify-center { - justify-content: center; -} - -.justify-between { - justify-content: space-between; -} - -.gap-2 { - gap: 0.5rem; -} - -.gap-4 { - gap: 1rem; -} - -.gap-6 { - gap: 1.5rem; -} - -.gap-8 { - gap: 2rem; -} - -.space-y-4 > :not([hidden]) ~ :not([hidden]) { - --tw-space-y-reverse: 0; - margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse))); - margin-bottom: calc(1rem * var(--tw-space-y-reverse)); -} - -.rounded { - border-radius: 0.25rem; -} - -.rounded-lg { - border-radius: 0.5rem; -} - -.rounded-md { - border-radius: 0.375rem; -} - -.border { - border-width: 1px; -} - -.border-4 { - border-width: 4px; -} - -.border-b { - border-bottom-width: 1px; -} - -.border-black { - --tw-border-opacity: 1; - border-color: rgb(0 0 0 / var(--tw-border-opacity, 1)); -} - -.border-blue-700 { - --tw-border-opacity: 1; - border-color: rgb(29 78 216 / var(--tw-border-opacity, 1)); -} - -.border-gray-200 { - --tw-border-opacity: 1; - border-color: rgb(229 231 235 / var(--tw-border-opacity, 1)); -} - -.border-gray-300 { - --tw-border-opacity: 1; - border-color: rgb(209 213 219 / var(--tw-border-opacity, 1)); -} - -.bg-black { - --tw-bg-opacity: 1; - background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1)); -} - -.bg-gray-100 { - --tw-bg-opacity: 1; - background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)); -} - -.bg-gray-200 { - --tw-bg-opacity: 1; - background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1)); -} - -.bg-gray-300 { - --tw-bg-opacity: 1; - background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1)); -} - -.bg-transparent { - background-color: transparent; -} - -.bg-white { - --tw-bg-opacity: 1; - background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)); -} - -.bg-yellow-500 { - --tw-bg-opacity: 1; - background-color: rgb(234 179 8 / var(--tw-bg-opacity, 1)); -} - -.p-4 { - padding: 1rem; -} - -.p-8 { - padding: 2rem; -} - -.px-3 { - padding-left: 0.75rem; - padding-right: 0.75rem; -} - -.px-4 { - padding-left: 1rem; - padding-right: 1rem; -} - -.py-2 { - padding-top: 0.5rem; - padding-bottom: 0.5rem; -} - -.pb-2 { - padding-bottom: 0.5rem; -} - -.pl-10 { - padding-left: 2.5rem; -} - -.pl-3 { - padding-left: 0.75rem; -} - -.pl-4 { - padding-left: 1rem; -} - -.pr-3 { - padding-right: 0.75rem; -} - -.text-center { - text-align: center; -} - -.font-sans { - font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; -} - -.text-2xl { - font-size: 1.5rem; - line-height: 2rem; -} - -.text-3xl { - font-size: 1.875rem; - line-height: 2.25rem; -} - -.text-4xl { - font-size: 2.25rem; - line-height: 2.5rem; -} - -.text-lg { - font-size: 1.125rem; - line-height: 1.75rem; -} - -.text-sm { - font-size: 0.875rem; - line-height: 1.25rem; -} - -.text-xl { - font-size: 1.25rem; - line-height: 1.75rem; -} - -.font-bold { - font-weight: 700; -} - -.font-medium { - font-weight: 500; -} - -.font-semibold { - font-weight: 600; -} - -.leading-relaxed { - line-height: 1.625; -} - -.text-black { - --tw-text-opacity: 1; - color: rgb(0 0 0 / var(--tw-text-opacity, 1)); -} - -.text-gray-400 { - --tw-text-opacity: 1; - color: rgb(156 163 175 / var(--tw-text-opacity, 1)); -} - -.text-gray-500 { - --tw-text-opacity: 1; - color: rgb(107 114 128 / var(--tw-text-opacity, 1)); -} - -.text-gray-600 { - --tw-text-opacity: 1; - color: rgb(75 85 99 / var(--tw-text-opacity, 1)); -} - -.text-gray-700 { - --tw-text-opacity: 1; - color: rgb(55 65 81 / var(--tw-text-opacity, 1)); -} - -.text-gray-800 { - --tw-text-opacity: 1; - color: rgb(31 41 55 / var(--tw-text-opacity, 1)); -} - -.text-red-600 { - --tw-text-opacity: 1; - color: rgb(220 38 38 / var(--tw-text-opacity, 1)); -} - -.text-white { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity, 1)); -} - -.opacity-25 { - opacity: 0.25; -} - -.opacity-75 { - opacity: 0.75; -} - -.shadow-lg { - --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); - --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -.shadow-md { - --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); - --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -.shadow-sm { - --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); - --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -.invert { - --tw-invert: invert(100%); - filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); -} - -.filter { - filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); -} - -.hover\:bg-gray-100:hover { - --tw-bg-opacity: 1; - background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)); -} - -.hover\:bg-gray-300:hover { - --tw-bg-opacity: 1; - background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1)); -} - -.hover\:bg-gray-800:hover { - --tw-bg-opacity: 1; - background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1)); -} - -.hover\:bg-yellow-600:hover { - --tw-bg-opacity: 1; - background-color: rgb(202 138 4 / var(--tw-bg-opacity, 1)); -} - -.focus\:border-indigo-300:focus { - --tw-border-opacity: 1; - border-color: rgb(165 180 252 / var(--tw-border-opacity, 1)); -} - -.focus\:outline-none:focus { - outline: 2px solid transparent; - outline-offset: 2px; -} - -.focus\:ring:focus { - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); -} - -.focus\:ring-2:focus { - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); -} - -.focus\:ring-blue-500:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1)); -} - -.focus\:ring-gray-500:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity, 1)); -} - -.focus\:ring-indigo-200:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(199 210 254 / var(--tw-ring-opacity, 1)); -} - -.focus\:ring-yellow-500:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(234 179 8 / var(--tw-ring-opacity, 1)); -} - -.focus\:ring-opacity-50:focus { - --tw-ring-opacity: 0.5; -} - -.focus\:ring-offset-2:focus { - --tw-ring-offset-width: 2px; -} - -@media (min-width: 768px) { - .md\:grid-cols-2 { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } -} \ No newline at end of file From c9859bdcfd0076a9d50b43d817c7f23939f25c94 Mon Sep 17 00:00:00 2001 From: Akshay Mathur Date: Wed, 5 Nov 2025 00:35:59 +0530 Subject: [PATCH 6/6] Fixed the directory sync. App tested on sqlite. --- .../vms/controller/VisitorController.java | 6 - .../vms/dto/DirectorySyncResult.java | 12 + .../com/statusneo/vms/dto/UserResponse.java | 52 ++++ .../statusneo/vms/dto/UsersDeltaResponse.java | 52 ++++ .../vms/exception/DirectorySyncException.java | 18 ++ .../com/statusneo/vms/model/Employee.java | 29 +- .../com/statusneo/vms/model/SyncAudit.java | 11 + .../vms/repository/EmployeeRepository.java | 1 + .../vms/service/GraphDirectoryService.java | 254 ++++++++++-------- .../vms/service/GraphEmailService.java | 2 +- .../statusneo/vms/service/ScheduledTasks.java | 7 +- .../statusneo/vms/service/StartupTasks.java | 12 +- .../statusneo/vms/service/VisitService.java | 3 - .../src/main/resources/application-sqlite.yml | 12 +- .../service/GraphDirectoryServiceTest.java | 114 -------- 15 files changed, 343 insertions(+), 242 deletions(-) create mode 100644 web-backend/src/main/java/com/statusneo/vms/dto/DirectorySyncResult.java create mode 100644 web-backend/src/main/java/com/statusneo/vms/dto/UserResponse.java create mode 100644 web-backend/src/main/java/com/statusneo/vms/dto/UsersDeltaResponse.java create mode 100644 web-backend/src/main/java/com/statusneo/vms/exception/DirectorySyncException.java delete mode 100644 web-backend/src/test/java/com/statusneo/vms/service/GraphDirectoryServiceTest.java diff --git a/web-backend/src/main/java/com/statusneo/vms/controller/VisitorController.java b/web-backend/src/main/java/com/statusneo/vms/controller/VisitorController.java index 117bcad..391fba7 100644 --- a/web-backend/src/main/java/com/statusneo/vms/controller/VisitorController.java +++ b/web-backend/src/main/java/com/statusneo/vms/controller/VisitorController.java @@ -100,12 +100,6 @@ public ResponseEntity refreshEmployeeCache() { return ResponseEntity.ok("Cache refreshed"); } - @PostMapping("/sync-employees") - public ResponseEntity syncEmployees() { - int count = graphDirectoryService.syncAllUsersToEmployees(); - return ResponseEntity.ok("Synced " + count + " employees from Office365"); - } - @PostMapping("/register") public String registerVisitor(@ModelAttribute Visitor visitor, @RequestParam(value = "host", required = false) String host, diff --git a/web-backend/src/main/java/com/statusneo/vms/dto/DirectorySyncResult.java b/web-backend/src/main/java/com/statusneo/vms/dto/DirectorySyncResult.java new file mode 100644 index 0000000..1ea5c01 --- /dev/null +++ b/web-backend/src/main/java/com/statusneo/vms/dto/DirectorySyncResult.java @@ -0,0 +1,12 @@ +package com.statusneo.vms.dto; + +/** + * Result container for directory synchronization operations. + * Contains the number of upserts performed and the delta link for future incremental syncs. + * + * @param upserts the total number of employee records created or updated + * @param deltaLink the delta link from Microsoft Graph API for future incremental syncs (null if not available) + */ +public record DirectorySyncResult(int upserts, String deltaLink) { +} + diff --git a/web-backend/src/main/java/com/statusneo/vms/dto/UserResponse.java b/web-backend/src/main/java/com/statusneo/vms/dto/UserResponse.java new file mode 100644 index 0000000..072006e --- /dev/null +++ b/web-backend/src/main/java/com/statusneo/vms/dto/UserResponse.java @@ -0,0 +1,52 @@ +package com.statusneo.vms.dto; + +public class UserResponse { + private String id; + private String displayName; + private String mail; + private String userPrincipalName; + private Boolean accountEnabled; + + // Getters and setters + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getMail() { + return mail; + } + + public void setMail(String mail) { + this.mail = mail; + } + + public String getUserPrincipalName() { + return userPrincipalName; + } + + public void setUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + } + + public Boolean getAccountEnabled() { + return accountEnabled; + } + + public void setAccountEnabled(Boolean accountEnabled) { + this.accountEnabled = accountEnabled; + } +} + diff --git a/web-backend/src/main/java/com/statusneo/vms/dto/UsersDeltaResponse.java b/web-backend/src/main/java/com/statusneo/vms/dto/UsersDeltaResponse.java new file mode 100644 index 0000000..0cc7117 --- /dev/null +++ b/web-backend/src/main/java/com/statusneo/vms/dto/UsersDeltaResponse.java @@ -0,0 +1,52 @@ +package com.statusneo.vms.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class UsersDeltaResponse { + @JsonProperty("@odata.context") + private String context; + + @JsonProperty("@odata.nextLink") + private String nextLink; + + @JsonProperty("@odata.deltaLink") + private String deltaLink; // Optional, appears in final page + + private List value; + + // Getters and setters + + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public String getNextLink() { + return nextLink; + } + + public void setNextLink(String nextLink) { + this.nextLink = nextLink; + } + + public String getDeltaLink() { + return deltaLink; + } + + public void setDeltaLink(String deltaLink) { + this.deltaLink = deltaLink; + } + + public List getValue() { + return value; + } + + public void setValue(List value) { + this.value = value; + } +} \ No newline at end of file diff --git a/web-backend/src/main/java/com/statusneo/vms/exception/DirectorySyncException.java b/web-backend/src/main/java/com/statusneo/vms/exception/DirectorySyncException.java new file mode 100644 index 0000000..65eb3c8 --- /dev/null +++ b/web-backend/src/main/java/com/statusneo/vms/exception/DirectorySyncException.java @@ -0,0 +1,18 @@ +package com.statusneo.vms.exception; + +/** + * Exception thrown when directory synchronization operations fail. + * This exception is used to indicate failures during Microsoft Graph API + * calls or other directory sync operations. + */ +public class DirectorySyncException extends RuntimeException { + + public DirectorySyncException(String message) { + super(message); + } + + public DirectorySyncException(String message, Throwable cause) { + super(message, cause); + } +} + diff --git a/web-backend/src/main/java/com/statusneo/vms/model/Employee.java b/web-backend/src/main/java/com/statusneo/vms/model/Employee.java index c3c2a2d..a6a0a23 100644 --- a/web-backend/src/main/java/com/statusneo/vms/model/Employee.java +++ b/web-backend/src/main/java/com/statusneo/vms/model/Employee.java @@ -32,7 +32,10 @@ public class Employee { private Long id; private String name; - private String email; // Add this field + private String email; + private String guid; // Microsoft Graph user ID + private String userPrincipalName; + private Boolean accountEnabled; public String getEmail() { return email; @@ -53,6 +56,30 @@ public Long getId() { return id; } + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public String getUserPrincipalName() { + return userPrincipalName; + } + + public void setUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + } + + public Boolean getAccountEnabled() { + return accountEnabled; + } + + public void setAccountEnabled(Boolean accountEnabled) { + this.accountEnabled = accountEnabled; + } + public Employee(String name) { this.name = name; } diff --git a/web-backend/src/main/java/com/statusneo/vms/model/SyncAudit.java b/web-backend/src/main/java/com/statusneo/vms/model/SyncAudit.java index eec7e6d..9479a3e 100644 --- a/web-backend/src/main/java/com/statusneo/vms/model/SyncAudit.java +++ b/web-backend/src/main/java/com/statusneo/vms/model/SyncAudit.java @@ -29,6 +29,9 @@ public class SyncAudit { @Column(name = "error_message", length = 2000) private String errorMessage; + @Column(name = "delta_link", length = 2000) + private String deltaLink; + // Getters and Setters public Long getId() { return id; @@ -85,4 +88,12 @@ public String getErrorMessage() { public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } + + public String getDeltaLink() { + return deltaLink; + } + + public void setDeltaLink(String deltaLink) { + this.deltaLink = deltaLink; + } } \ No newline at end of file diff --git a/web-backend/src/main/java/com/statusneo/vms/repository/EmployeeRepository.java b/web-backend/src/main/java/com/statusneo/vms/repository/EmployeeRepository.java index 187f852..1efa722 100644 --- a/web-backend/src/main/java/com/statusneo/vms/repository/EmployeeRepository.java +++ b/web-backend/src/main/java/com/statusneo/vms/repository/EmployeeRepository.java @@ -32,5 +32,6 @@ public interface EmployeeRepository extends JpaRepository { List findByNameStartingWithIgnoreCase(String name); Optional findByEmail(String email); List findByEmailIn(Collection emails); + List findByGuidIn(Collection guids); java.util.Optional findByNameIgnoreCase(String name); } diff --git a/web-backend/src/main/java/com/statusneo/vms/service/GraphDirectoryService.java b/web-backend/src/main/java/com/statusneo/vms/service/GraphDirectoryService.java index 428a4ee..eccdbce 100644 --- a/web-backend/src/main/java/com/statusneo/vms/service/GraphDirectoryService.java +++ b/web-backend/src/main/java/com/statusneo/vms/service/GraphDirectoryService.java @@ -18,13 +18,15 @@ */ package com.statusneo.vms.service; +import com.statusneo.vms.dto.DirectorySyncResult; +import com.statusneo.vms.dto.UserResponse; +import com.statusneo.vms.dto.UsersDeltaResponse; import com.statusneo.vms.cache.EmployeeNameCache; +import com.statusneo.vms.exception.DirectorySyncException; import com.statusneo.vms.model.Employee; import com.statusneo.vms.repository.EmployeeRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.security.oauth2.client.OAuth2AuthorizeRequest; @@ -32,6 +34,7 @@ import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager; import org.springframework.stereotype.Service; import org.springframework.web.client.RestClient; +import org.springframework.web.client.RestClientException; import java.util.*; import java.util.stream.Collectors; @@ -65,131 +68,166 @@ public GraphDirectoryService( * - prepare new Employee entities for missing emails and update names for existing ones * - call saveAll to perform batch inserts/updates * - * It returns the total number of upserts performed. + * It returns the total number of upserts performed and the delta link for future incremental syncs. * - * @return total number of upserts performed + * @return DirectorySyncResult containing the number of upserts and the delta link (if available) */ - public int syncAllUsersToEmployees() { + public DirectorySyncResult syncAllUsersToEmployees() { String token = getAccessToken(); - String url = "https://graph.microsoft.com/v1.0/users?$select=displayName,mail,userPrincipalName&$top=9"; - - HttpHeaders headers = new HttpHeaders(); - headers.setBearerAuth(token); - headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); - HttpEntity entity = new HttpEntity<>(headers); - - String nextLink = url; + String nextLink = "https://graph.microsoft.com/v1.0/users/delta?$select=id,displayName,mail,userPrincipalName,accountEnabled"; List namesForCache = new ArrayList<>(); int processed = 0; + String deltaLink = null; while (nextLink != null) { // Log the outgoing HTTP request (method + url) while redacting sensitive headers - logger.info("Graph API request: method=GET url={} headers={}", nextLink, maskHeaders(headers)); - ResponseEntity response = restClient.get() - .uri(nextLink) - .headers(httpHeaders -> { - httpHeaders.setBearerAuth(token); - httpHeaders.setAccept(List.of(MediaType.APPLICATION_JSON)); - }) - .retrieve() - .toEntity(Map.class); - if (!response.getStatusCode().is2xxSuccessful()) { - break; - } - Map body = response.getBody(); - if (body == null) { - break; - } - Object values = body.get("value"); - if (values instanceof List list) { - // Collect emails and display names from the page - List> userMaps = list.stream() - .filter(item -> item instanceof Map) - .map(item -> (Map) item) - .collect(Collectors.toList()); - - Set emailsInPage = userMaps.stream() - .map(m -> { - String mail = Objects.toString(m.get("mail"), null); - String upn = Objects.toString(m.get("userPrincipalName"), null); - String email = mail != null && !mail.isBlank() ? mail : upn; - return (email == null || email.isBlank()) ? null : email.toLowerCase(); + logger.info("Graph API request: method=GET url={}", nextLink); + try { + ResponseEntity response = restClient.get() + .uri(nextLink) + .headers(httpHeaders -> { + httpHeaders.setBearerAuth(token); + httpHeaders.setAccept(List.of(MediaType.APPLICATION_JSON)); }) - .filter(Objects::nonNull) - .collect(Collectors.toSet()); - - if (!emailsInPage.isEmpty()) { - // Load existing employees for the page in one query - List existing = employeeRepository.findByEmailIn(emailsInPage); - Set existingEmails = existing.stream() - .map(e -> e.getEmail().toLowerCase()) - .collect(Collectors.toSet()); - - List toSave = new ArrayList<>(); - - // For each user map, decide whether to insert new or update existing entity - for (Map userMap : userMaps) { - String displayName = Objects.toString(userMap.get("displayName"), null); - String mail = Objects.toString(userMap.get("mail"), null); - String upn = Objects.toString(userMap.get("userPrincipalName"), null); - String email = mail != null && !mail.isBlank() ? mail : upn; - if (email == null || email.isBlank() || displayName == null || displayName.isBlank()) { - continue; - } - String emailLower = email.toLowerCase(); - if (existingEmails.contains(emailLower)) { - // update the existing entity's name - for (Employee e : existing) { - if (e.getEmail().equalsIgnoreCase(email)) { - if (!displayName.equals(e.getName())) { - e.setName(displayName); - toSave.add(e); - } - break; - } - } - } else { - Employee e = new Employee(); - e.setEmail(email); - e.setName(displayName); - toSave.add(e); - } - } - - if (!toSave.isEmpty()) { - List saved = employeeRepository.saveAll(toSave); - // Update cache and processed count - for (Employee s : saved) { - namesForCache.add(s.getName()); - } - processed += saved.size(); - } + .retrieve() + .toEntity(UsersDeltaResponse.class); + if (!response.getStatusCode().is2xxSuccessful()) { + String errorMessage = String.format("Graph API request failed with status code %d for URL: %s", + response.getStatusCode().value(), nextLink); + logger.error(errorMessage); + throw new DirectorySyncException(errorMessage); + } + UsersDeltaResponse body = response.getBody(); + if (body == null) { + String errorMessage = String.format("Graph API returned null response body for URL: %s", nextLink); + logger.error(errorMessage); + throw new DirectorySyncException(errorMessage); + } + + int pageProcessed = processUsersResponse(body, namesForCache); + processed += pageProcessed; + + // Check for deltaLink (appears on final page when delta query completes) + if (body.getDeltaLink() != null) { + deltaLink = body.getDeltaLink(); + logger.info("Delta query completed. Delta link received for future incremental syncs"); } - } - Object next = body.get("@odata.nextLink"); - nextLink = next instanceof String ? (String) next : null; + nextLink = body.getNextLink(); + } catch (RestClientException e) { + String errorMessage = String.format("Graph API request failed for URL: %s", nextLink); + logger.error(errorMessage, e); + throw new DirectorySyncException(errorMessage, e); + } } employeeNameCache.clear(); employeeNameCache.bulkInsert(namesForCache); int upserts = processed; logger.info("Employee sync complete. Upserts: {}", upserts); - return upserts; + return new DirectorySyncResult(upserts, deltaLink); } - // Return a string representation of headers with Authorization redacted for safe logging - private String maskHeaders(HttpHeaders headers) { - if (headers == null) return "{}"; - HttpHeaders copy = new HttpHeaders(); - headers.forEach((k, v) -> { - if ("Authorization".equalsIgnoreCase(k)) { - copy.put(k, Collections.singletonList("REDACTED")); + /** + * Process a page of users from the Graph API response. + * Extracts users, determines which employees need to be created or updated, + * performs the database operations, and collects names for cache updates. + * + * @param body the Graph API response body containing users + * @param namesForCache list to collect employee names for cache updates + * @return number of employees processed (upserted) + */ + private int processUsersResponse(UsersDeltaResponse body, List namesForCache) { + List users = body.getValue(); + if (users == null || users.isEmpty()) { + return 0; + } + + // Collect GUIDs from the page (filter out nulls) + Set guidsInPage = users.stream() + .map(UserResponse::getId) + .filter(Objects::nonNull) + .filter(id -> !id.isBlank()) + .collect(Collectors.toSet()); + + if (guidsInPage.isEmpty()) { + return 0; + } + + // Load existing employees for the page by GUID in one query + List existing = employeeRepository.findByGuidIn(guidsInPage); + Map existingByGuid = existing.stream() + .filter(e -> e.getGuid() != null) + .collect(Collectors.toMap( + Employee::getGuid, + e -> e, + (e1, e2) -> e1 // In case of duplicates, keep first + )); + + List toSave = new ArrayList<>(); + + // For each user, decide whether to insert new or update existing entity + for (UserResponse user : users) { + String userId = user.getId(); + if (userId == null || userId.isBlank()) { + continue; // Skip users without GUID + } + + String displayName = user.getDisplayName(); + String mail = user.getMail(); + String upn = user.getUserPrincipalName(); + String email = mail != null && !mail.isBlank() ? mail : upn; + + if (email == null || email.isBlank() || displayName == null || displayName.isBlank()) { + continue; + } + + Employee existingEmployee = existingByGuid.get(userId); + + if (existingEmployee != null) { + // Update existing entity with all fields + boolean needsUpdate = false; + if (!displayName.equals(existingEmployee.getName())) { + existingEmployee.setName(displayName); + needsUpdate = true; + } + if (!email.equalsIgnoreCase(existingEmployee.getEmail())) { + existingEmployee.setEmail(email); + needsUpdate = true; + } + if (upn != null && !upn.equals(existingEmployee.getUserPrincipalName())) { + existingEmployee.setUserPrincipalName(upn); + needsUpdate = true; + } + if (user.getAccountEnabled() != null && !user.getAccountEnabled().equals(existingEmployee.getAccountEnabled())) { + existingEmployee.setAccountEnabled(user.getAccountEnabled()); + needsUpdate = true; + } + if (needsUpdate) { + toSave.add(existingEmployee); + } } else { - copy.put(k, v); + // Create new employee entity + Employee e = new Employee(); + e.setEmail(email); + e.setName(displayName); + e.setGuid(userId); + e.setUserPrincipalName(upn); + e.setAccountEnabled(user.getAccountEnabled()); + toSave.add(e); } - }); - return copy.toString(); + } + + if (toSave.isEmpty()) { + return 0; + } + + List saved = employeeRepository.saveAll(toSave); + // Update cache and processed count + for (Employee s : saved) { + namesForCache.add(s.getName()); + } + return saved.size(); } private String getAccessToken() { @@ -199,7 +237,9 @@ private String getAccessToken() { .build(); OAuth2AuthorizedClient client = authorizedClientManager.authorize(authorizeRequest); if (client == null || client.getAccessToken() == null) { - throw new IllegalStateException("Failed to obtain Graph access token"); + String errorMessage = "Failed to obtain Graph access token"; + logger.error(errorMessage); + throw new DirectorySyncException(errorMessage); } return client.getAccessToken().getTokenValue(); } diff --git a/web-backend/src/main/java/com/statusneo/vms/service/GraphEmailService.java b/web-backend/src/main/java/com/statusneo/vms/service/GraphEmailService.java index b4c5d46..67bee2b 100644 --- a/web-backend/src/main/java/com/statusneo/vms/service/GraphEmailService.java +++ b/web-backend/src/main/java/com/statusneo/vms/service/GraphEmailService.java @@ -41,7 +41,7 @@ * Service responsible for handling all email communications in the Visitor Management System. */ @Service -@Profile({"prod", "default"}) +@Profile({"prod", "default", "sqlite"}) public class GraphEmailService implements EmailService { private static final Logger logger = LoggerFactory.getLogger(GraphEmailService.class); diff --git a/web-backend/src/main/java/com/statusneo/vms/service/ScheduledTasks.java b/web-backend/src/main/java/com/statusneo/vms/service/ScheduledTasks.java index 43b2143..121912e 100644 --- a/web-backend/src/main/java/com/statusneo/vms/service/ScheduledTasks.java +++ b/web-backend/src/main/java/com/statusneo/vms/service/ScheduledTasks.java @@ -18,6 +18,7 @@ */ package com.statusneo.vms.service; +import com.statusneo.vms.dto.DirectorySyncResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Profile; @@ -44,10 +45,12 @@ public void sendVisitorReport() { excelService.sendVisitorReport(); } - @Scheduled(cron = "0 0 1 * * *") + // @Scheduled(cron = "0 0 1 * * *") public void syncEmployeesFromGraph() { try { - graphDirectoryService.syncAllUsersToEmployees(); + DirectorySyncResult result = graphDirectoryService.syncAllUsersToEmployees(); + log.info("Scheduled sync completed. Upserts: {}, Delta link: {}", + result.upserts(), result.deltaLink() != null ? "received" : "not available"); } catch (Exception e) { log.error("Failed to sync users from Graph to employees", e); // consider adding metrics/alerts or retrying with backoff here diff --git a/web-backend/src/main/java/com/statusneo/vms/service/StartupTasks.java b/web-backend/src/main/java/com/statusneo/vms/service/StartupTasks.java index ca2b91c..ff0cdf4 100644 --- a/web-backend/src/main/java/com/statusneo/vms/service/StartupTasks.java +++ b/web-backend/src/main/java/com/statusneo/vms/service/StartupTasks.java @@ -1,5 +1,7 @@ package com.statusneo.vms.service; +import com.statusneo.vms.dto.DirectorySyncResult; +import com.statusneo.vms.exception.DirectorySyncException; import com.statusneo.vms.model.SyncAudit; import com.statusneo.vms.repository.SyncAuditRepository; import org.slf4j.Logger; @@ -15,7 +17,7 @@ import java.time.LocalDateTime; @Component -@Profile({"prod", "default"}) +@Profile({"prod", "default", "sqlite"}) public class StartupTasks { private static final Logger log = LoggerFactory.getLogger(StartupTasks.class); @@ -66,16 +68,18 @@ public void syncEmployeesFromGraphOnStartup() { int upserts = 0; // track progress and ensure available in catch try { - upserts = graphDirectoryService.syncAllUsersToEmployees(); + DirectorySyncResult result = graphDirectoryService.syncAllUsersToEmployees(); + upserts = result.upserts(); audit.setEndTime(LocalDateTime.now()); audit.setRecordsProcessed(upserts); audit.setStatus(STATUS_SUCCESS); audit.setErrorMessage(null); - log.info("Successfully synced {} employees from Graph", upserts); + audit.setDeltaLink(result.deltaLink()); + log.info("Successfully synced {} employees from Graph. Delta link: {}", upserts, result.deltaLink() != null ? "received" : "not available"); syncAuditRepository.save(audit); - } catch (Exception e) { + } catch (DirectorySyncException e) { audit.setEndTime(LocalDateTime.now()); audit.setRecordsProcessed(upserts); audit.setStatus(STATUS_FAILED); diff --git a/web-backend/src/main/java/com/statusneo/vms/service/VisitService.java b/web-backend/src/main/java/com/statusneo/vms/service/VisitService.java index b569196..b75a9e5 100644 --- a/web-backend/src/main/java/com/statusneo/vms/service/VisitService.java +++ b/web-backend/src/main/java/com/statusneo/vms/service/VisitService.java @@ -45,8 +45,6 @@ public class VisitService { private final NotificationService notificationService; - private final EmailService emailService; - private final VisitRepository visitRepository; private static final Logger logger = LoggerFactory.getLogger(VisitService.class); @@ -55,7 +53,6 @@ public VisitService(OtpService otpService, VisitorRepository visitorRepository, this.otpService = otpService; this.visitorRepository = visitorRepository; this.notificationService = notificationService; - this.emailService = emailService; this.visitRepository = visitRepository; } diff --git a/web-backend/src/main/resources/application-sqlite.yml b/web-backend/src/main/resources/application-sqlite.yml index 31741a1..8da9e8c 100644 --- a/web-backend/src/main/resources/application-sqlite.yml +++ b/web-backend/src/main/resources/application-sqlite.yml @@ -12,9 +12,13 @@ spring: properties: hibernate: format_sql: true +# SQLite does not require Flyway migrations since schema is managed by Hibernate flyway: enabled: false - -# SQLite does not require Flyway migrations since schema is managed by Hibernate -flyway: - enabled: false + docker: + compose: + enabled: false +vms: + sync: + onstartup: + enabled: true diff --git a/web-backend/src/test/java/com/statusneo/vms/service/GraphDirectoryServiceTest.java b/web-backend/src/test/java/com/statusneo/vms/service/GraphDirectoryServiceTest.java deleted file mode 100644 index 0e057e6..0000000 --- a/web-backend/src/test/java/com/statusneo/vms/service/GraphDirectoryServiceTest.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.statusneo.vms.service; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestClient; - -import com.statusneo.vms.cache.EmployeeNameCache; -import com.statusneo.vms.model.Employee; -import com.statusneo.vms.repository.EmployeeRepository; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class GraphDirectoryServiceTest { - - @Mock - private RestClient restClient; - - @Mock - @SuppressWarnings("rawtypes") - private RestClient.RequestHeadersUriSpec requestHeadersUriSpec; - - @Mock - @SuppressWarnings("rawtypes") - private RestClient.RequestHeadersSpec requestHeadersSpec; - - @Mock - private RestClient.ResponseSpec responseSpec; - - @Mock - private EmployeeRepository employeeRepository; - - @Mock - private EmployeeNameCache employeeNameCache; - - @InjectMocks - private GraphDirectoryService graphDirectoryService; - - @Test - void syncAllUsersToEmployees_successfulResponse() { - Map user = new HashMap<>(); - user.put("displayName", "Alice Smith"); - user.put("mail", "alice@example.com"); - - Map responseBody = new HashMap<>(); - responseBody.put("value", List.of(user)); - - ResponseEntity> responseEntity = new ResponseEntity<>(responseBody, HttpStatus.OK); - - when(employeeRepository.findByEmail("alice@example.com")).thenReturn(Optional.empty()); - when(employeeRepository.save(any(Employee.class))).thenAnswer(invocation -> invocation.getArgument(0)); - - mockRestClientResponse(responseEntity); - - int upserts = graphDirectoryService.syncAllUsersToEmployees(); - - assertEquals(1, upserts); - verify(employeeRepository).save(any(Employee.class)); - verify(employeeNameCache).clear(); - verify(employeeNameCache).bulkInsert(List.of("Alice Smith")); - } - - @Test - void syncAllUsersToEmployees_unsuccessfulResponse() { - ResponseEntity> responseEntity = new ResponseEntity<>((Map) null, HttpStatus.BAD_REQUEST); - - mockRestClientResponse(responseEntity); - - int upserts = graphDirectoryService.syncAllUsersToEmployees(); - - assertEquals(0, upserts); - verify(employeeRepository, never()).save(any(Employee.class)); - verify(employeeNameCache).clear(); - verify(employeeNameCache).bulkInsert(Collections.emptyList()); - } - - @Test - void syncAllUsersToEmployees_nullResponseBody() { - ResponseEntity> responseEntity = new ResponseEntity<>((Map) null, HttpStatus.OK); - - mockRestClientResponse(responseEntity); - - int upserts = graphDirectoryService.syncAllUsersToEmployees(); - - assertEquals(0, upserts); - verify(employeeRepository, never()).save(any(Employee.class)); - verify(employeeNameCache).clear(); - verify(employeeNameCache).bulkInsert(Collections.emptyList()); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - private void mockRestClientResponse(ResponseEntity> responseEntity) { - when(restClient.get()).thenReturn(requestHeadersUriSpec); - when(requestHeadersUriSpec.uri(anyString())).thenReturn(requestHeadersSpec); - when(requestHeadersSpec.retrieve()).thenReturn(responseSpec); - when(responseSpec.toEntity(Map.class)).thenReturn((ResponseEntity) responseEntity); - } -} \ No newline at end of file