aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-02-26 20:41:35 -0500
committersowgro <tpoke.ferrari@gmail.com>2025-02-26 20:41:35 -0500
commit8a2d6c332a089c2dbb7351514499e16f343959ff (patch)
tree9451b9a92b8fc43ed88d215fd3b8a63a151f12f7 /ufund-ui
parent04910f9a8e8b30add77852ac2968acdbda834a83 (diff)
downloadJellySolutions-8a2d6c332a089c2dbb7351514499e16f343959ff.tar.gz
JellySolutions-8a2d6c332a089c2dbb7351514499e16f343959ff.tar.bz2
JellySolutions-8a2d6c332a089c2dbb7351514499e16f343959ff.zip
Start services and organize project
Diffstat (limited to 'ufund-ui')
-rw-r--r--ufund-ui/.editorconfig2
-rw-r--r--ufund-ui/src/app/app-routing.module.ts10
-rw-r--r--ufund-ui/src/app/app.module.ts10
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.css (renamed from ufund-ui/src/app/cupboard/cupboard.component.css)0
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.html (renamed from ufund-ui/src/app/cupboard/cupboard.component.html)0
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.spec.ts (renamed from ufund-ui/src/app/cupboard/cupboard.component.spec.ts)0
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.ts (renamed from ufund-ui/src/app/cupboard/cupboard.component.ts)0
-rw-r--r--ufund-ui/src/app/components/dashboard/dashboard.component.css (renamed from ufund-ui/src/app/dashboard/dashboard.component.css)0
-rw-r--r--ufund-ui/src/app/components/dashboard/dashboard.component.html (renamed from ufund-ui/src/app/dashboard/dashboard.component.html)0
-rw-r--r--ufund-ui/src/app/components/dashboard/dashboard.component.spec.ts (renamed from ufund-ui/src/app/dashboard/dashboard.component.spec.ts)0
-rw-r--r--ufund-ui/src/app/components/dashboard/dashboard.component.ts (renamed from ufund-ui/src/app/dashboard/dashboard.component.ts)0
-rw-r--r--ufund-ui/src/app/components/funding-basket/funding-basket.component.css (renamed from ufund-ui/src/app/funding-basket/funding-basket.component.css)0
-rw-r--r--ufund-ui/src/app/components/funding-basket/funding-basket.component.html (renamed from ufund-ui/src/app/funding-basket/funding-basket.component.html)0
-rw-r--r--ufund-ui/src/app/components/funding-basket/funding-basket.component.spec.ts (renamed from ufund-ui/src/app/funding-basket/funding-basket.component.spec.ts)0
-rw-r--r--ufund-ui/src/app/components/funding-basket/funding-basket.component.ts (renamed from ufund-ui/src/app/funding-basket/funding-basket.component.ts)0
-rw-r--r--ufund-ui/src/app/components/home-page/home-page.component.css (renamed from ufund-ui/src/app/home-page/home-page.component.css)0
-rw-r--r--ufund-ui/src/app/components/home-page/home-page.component.html (renamed from ufund-ui/src/app/home-page/home-page.component.html)0
-rw-r--r--ufund-ui/src/app/components/home-page/home-page.component.spec.ts (renamed from ufund-ui/src/app/home-page/home-page.component.spec.ts)0
-rw-r--r--ufund-ui/src/app/components/home-page/home-page.component.ts (renamed from ufund-ui/src/app/home-page/home-page.component.ts)0
-rw-r--r--ufund-ui/src/app/components/login/login.component.css4
-rw-r--r--ufund-ui/src/app/components/login/login.component.html5
-rw-r--r--ufund-ui/src/app/components/login/login.component.spec.ts (renamed from ufund-ui/src/app/login/login.component.spec.ts)0
-rw-r--r--ufund-ui/src/app/components/login/login.component.ts (renamed from ufund-ui/src/app/login/login.component.ts)0
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.css (renamed from ufund-ui/src/app/need-list/need-list.component.css)0
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.html (renamed from ufund-ui/src/app/need-list/need-list.component.html)0
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.spec.ts (renamed from ufund-ui/src/app/need-list/need-list.component.spec.ts)0
-rw-r--r--ufund-ui/src/app/components/need-list/need-list.component.ts (renamed from ufund-ui/src/app/need-list/need-list.component.ts)0
-rw-r--r--ufund-ui/src/app/components/need-page/need-page.component.css (renamed from ufund-ui/src/app/need-page/need-page.component.css)0
-rw-r--r--ufund-ui/src/app/components/need-page/need-page.component.html (renamed from ufund-ui/src/app/need-page/need-page.component.html)0
-rw-r--r--ufund-ui/src/app/components/need-page/need-page.component.spec.ts (renamed from ufund-ui/src/app/need-page/need-page.component.spec.ts)0
-rw-r--r--ufund-ui/src/app/components/need-page/need-page.component.ts (renamed from ufund-ui/src/app/need-page/need-page.component.ts)5
-rw-r--r--ufund-ui/src/app/login/login.component.css0
-rw-r--r--ufund-ui/src/app/login/login.component.html1
-rw-r--r--ufund-ui/src/app/models/Need.ts13
-rw-r--r--ufund-ui/src/app/models/User.ts6
-rw-r--r--ufund-ui/src/app/services/cupboard.service.spec.ts16
-rw-r--r--ufund-ui/src/app/services/cupboard.service.ts44
-rw-r--r--ufund-ui/src/app/services/users.service.spec.ts16
-rw-r--r--ufund-ui/src/app/services/users.service.ts35
39 files changed, 153 insertions, 14 deletions
diff --git a/ufund-ui/.editorconfig b/ufund-ui/.editorconfig
index f166060..7b30331 100644
--- a/ufund-ui/.editorconfig
+++ b/ufund-ui/.editorconfig
@@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
indent_style = space
-indent_size = 2
+indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
diff --git a/ufund-ui/src/app/app-routing.module.ts b/ufund-ui/src/app/app-routing.module.ts
index 9e3c5ef..36e74d3 100644
--- a/ufund-ui/src/app/app-routing.module.ts
+++ b/ufund-ui/src/app/app-routing.module.ts
@@ -1,10 +1,10 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
-import {CupboardComponent} from './cupboard/cupboard.component';
-import {DashboardComponent} from './dashboard/dashboard.component';
-import {LoginComponent} from './login/login.component';
-import {HomePageComponent} from './home-page/home-page.component';
-import {FundingBasketComponent} from './funding-basket/funding-basket.component';
+import {CupboardComponent} from './components/cupboard/cupboard.component';
+import {DashboardComponent} from './components/dashboard/dashboard.component';
+import {LoginComponent} from './components/login/login.component';
+import {HomePageComponent} from './components/home-page/home-page.component';
+import {FundingBasketComponent} from './components/funding-basket/funding-basket.component';
const routes: Routes = [
{path: '', component: HomePageComponent},
diff --git a/ufund-ui/src/app/app.module.ts b/ufund-ui/src/app/app.module.ts
index ee2d578..95208e1 100644
--- a/ufund-ui/src/app/app.module.ts
+++ b/ufund-ui/src/app/app.module.ts
@@ -3,11 +3,11 @@ import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
-import { NeedPageComponent } from './need-page/need-page.component';
-import { HomePageComponent } from './home-page/home-page.component';
-import { FundingBasketComponent } from './funding-basket/funding-basket.component';
-import { CupboardComponent } from './cupboard/cupboard.component';
-import { NeedListComponent } from './need-list/need-list.component';
+import { NeedPageComponent } from './components/need-page/need-page.component';
+import { HomePageComponent } from './components/home-page/home-page.component';
+import { FundingBasketComponent } from './components/funding-basket/funding-basket.component';
+import { CupboardComponent } from './components/cupboard/cupboard.component';
+import { NeedListComponent } from './components/need-list/need-list.component';
@NgModule({
declarations: [
diff --git a/ufund-ui/src/app/cupboard/cupboard.component.css b/ufund-ui/src/app/components/cupboard/cupboard.component.css
index e69de29..e69de29 100644
--- a/ufund-ui/src/app/cupboard/cupboard.component.css
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.css
diff --git a/ufund-ui/src/app/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html
index bcddb33..bcddb33 100644
--- a/ufund-ui/src/app/cupboard/cupboard.component.html
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html
diff --git a/ufund-ui/src/app/cupboard/cupboard.component.spec.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.spec.ts
index ece4f23..ece4f23 100644
--- a/ufund-ui/src/app/cupboard/cupboard.component.spec.ts
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.spec.ts
diff --git a/ufund-ui/src/app/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts
index c78434e..c78434e 100644
--- a/ufund-ui/src/app/cupboard/cupboard.component.ts
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts
diff --git a/ufund-ui/src/app/dashboard/dashboard.component.css b/ufund-ui/src/app/components/dashboard/dashboard.component.css
index e69de29..e69de29 100644
--- a/ufund-ui/src/app/dashboard/dashboard.component.css
+++ b/ufund-ui/src/app/components/dashboard/dashboard.component.css
diff --git a/ufund-ui/src/app/dashboard/dashboard.component.html b/ufund-ui/src/app/components/dashboard/dashboard.component.html
index 9c5fce9..9c5fce9 100644
--- a/ufund-ui/src/app/dashboard/dashboard.component.html
+++ b/ufund-ui/src/app/components/dashboard/dashboard.component.html
diff --git a/ufund-ui/src/app/dashboard/dashboard.component.spec.ts b/ufund-ui/src/app/components/dashboard/dashboard.component.spec.ts
index 1a763b8..1a763b8 100644
--- a/ufund-ui/src/app/dashboard/dashboard.component.spec.ts
+++ b/ufund-ui/src/app/components/dashboard/dashboard.component.spec.ts
diff --git a/ufund-ui/src/app/dashboard/dashboard.component.ts b/ufund-ui/src/app/components/dashboard/dashboard.component.ts
index 6da4013..6da4013 100644
--- a/ufund-ui/src/app/dashboard/dashboard.component.ts
+++ b/ufund-ui/src/app/components/dashboard/dashboard.component.ts
diff --git a/ufund-ui/src/app/funding-basket/funding-basket.component.css b/ufund-ui/src/app/components/funding-basket/funding-basket.component.css
index e69de29..e69de29 100644
--- a/ufund-ui/src/app/funding-basket/funding-basket.component.css
+++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.css
diff --git a/ufund-ui/src/app/funding-basket/funding-basket.component.html b/ufund-ui/src/app/components/funding-basket/funding-basket.component.html
index 3fb2b5b..3fb2b5b 100644
--- a/ufund-ui/src/app/funding-basket/funding-basket.component.html
+++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.html
diff --git a/ufund-ui/src/app/funding-basket/funding-basket.component.spec.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.spec.ts
index 1cdd9d2..1cdd9d2 100644
--- a/ufund-ui/src/app/funding-basket/funding-basket.component.spec.ts
+++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.spec.ts
diff --git a/ufund-ui/src/app/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
index 8b12306..8b12306 100644
--- a/ufund-ui/src/app/funding-basket/funding-basket.component.ts
+++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
diff --git a/ufund-ui/src/app/home-page/home-page.component.css b/ufund-ui/src/app/components/home-page/home-page.component.css
index e69de29..e69de29 100644
--- a/ufund-ui/src/app/home-page/home-page.component.css
+++ b/ufund-ui/src/app/components/home-page/home-page.component.css
diff --git a/ufund-ui/src/app/home-page/home-page.component.html b/ufund-ui/src/app/components/home-page/home-page.component.html
index 7454417..7454417 100644
--- a/ufund-ui/src/app/home-page/home-page.component.html
+++ b/ufund-ui/src/app/components/home-page/home-page.component.html
diff --git a/ufund-ui/src/app/home-page/home-page.component.spec.ts b/ufund-ui/src/app/components/home-page/home-page.component.spec.ts
index 8ff10c7..8ff10c7 100644
--- a/ufund-ui/src/app/home-page/home-page.component.spec.ts
+++ b/ufund-ui/src/app/components/home-page/home-page.component.spec.ts
diff --git a/ufund-ui/src/app/home-page/home-page.component.ts b/ufund-ui/src/app/components/home-page/home-page.component.ts
index 5b2277c..5b2277c 100644
--- a/ufund-ui/src/app/home-page/home-page.component.ts
+++ b/ufund-ui/src/app/components/home-page/home-page.component.ts
diff --git a/ufund-ui/src/app/components/login/login.component.css b/ufund-ui/src/app/components/login/login.component.css
new file mode 100644
index 0000000..4cef8a0
--- /dev/null
+++ b/ufund-ui/src/app/components/login/login.component.css
@@ -0,0 +1,4 @@
+:host {
+ display: flex;
+ flex-direction: column;
+}
diff --git a/ufund-ui/src/app/components/login/login.component.html b/ufund-ui/src/app/components/login/login.component.html
new file mode 100644
index 0000000..1bf2a3f
--- /dev/null
+++ b/ufund-ui/src/app/components/login/login.component.html
@@ -0,0 +1,5 @@
+<p>Login:</p>
+<input placeholder="Username" type="text">
+<input placeholder="Password" type="password">
+<button>Login</button>
+<button>Create Account</button>
diff --git a/ufund-ui/src/app/login/login.component.spec.ts b/ufund-ui/src/app/components/login/login.component.spec.ts
index 4adbc3d..4adbc3d 100644
--- a/ufund-ui/src/app/login/login.component.spec.ts
+++ b/ufund-ui/src/app/components/login/login.component.spec.ts
diff --git a/ufund-ui/src/app/login/login.component.ts b/ufund-ui/src/app/components/login/login.component.ts
index efb8a58..efb8a58 100644
--- a/ufund-ui/src/app/login/login.component.ts
+++ b/ufund-ui/src/app/components/login/login.component.ts
diff --git a/ufund-ui/src/app/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css
index e69de29..e69de29 100644
--- a/ufund-ui/src/app/need-list/need-list.component.css
+++ b/ufund-ui/src/app/components/need-list/need-list.component.css
diff --git a/ufund-ui/src/app/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html
index d366ee6..d366ee6 100644
--- a/ufund-ui/src/app/need-list/need-list.component.html
+++ b/ufund-ui/src/app/components/need-list/need-list.component.html
diff --git a/ufund-ui/src/app/need-list/need-list.component.spec.ts b/ufund-ui/src/app/components/need-list/need-list.component.spec.ts
index f9b7830..f9b7830 100644
--- a/ufund-ui/src/app/need-list/need-list.component.spec.ts
+++ b/ufund-ui/src/app/components/need-list/need-list.component.spec.ts
diff --git a/ufund-ui/src/app/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts
index 61ed089..61ed089 100644
--- a/ufund-ui/src/app/need-list/need-list.component.ts
+++ b/ufund-ui/src/app/components/need-list/need-list.component.ts
diff --git a/ufund-ui/src/app/need-page/need-page.component.css b/ufund-ui/src/app/components/need-page/need-page.component.css
index e69de29..e69de29 100644
--- a/ufund-ui/src/app/need-page/need-page.component.css
+++ b/ufund-ui/src/app/components/need-page/need-page.component.css
diff --git a/ufund-ui/src/app/need-page/need-page.component.html b/ufund-ui/src/app/components/need-page/need-page.component.html
index ed5b6d8..ed5b6d8 100644
--- a/ufund-ui/src/app/need-page/need-page.component.html
+++ b/ufund-ui/src/app/components/need-page/need-page.component.html
diff --git a/ufund-ui/src/app/need-page/need-page.component.spec.ts b/ufund-ui/src/app/components/need-page/need-page.component.spec.ts
index 028c477..028c477 100644
--- a/ufund-ui/src/app/need-page/need-page.component.spec.ts
+++ b/ufund-ui/src/app/components/need-page/need-page.component.spec.ts
diff --git a/ufund-ui/src/app/need-page/need-page.component.ts b/ufund-ui/src/app/components/need-page/need-page.component.ts
index 4b7fd7e..390bfb6 100644
--- a/ufund-ui/src/app/need-page/need-page.component.ts
+++ b/ufund-ui/src/app/components/need-page/need-page.component.ts
@@ -1,4 +1,5 @@
-import { Component } from '@angular/core';
+import {Component, Input} from '@angular/core';
+import {Need} from '../../models/Need';
@Component({
selector: 'app-need-page',
@@ -7,5 +8,5 @@ import { Component } from '@angular/core';
styleUrl: './need-page.component.css'
})
export class NeedPageComponent {
-
+ @Input() need?: Need;
}
diff --git a/ufund-ui/src/app/login/login.component.css b/ufund-ui/src/app/login/login.component.css
deleted file mode 100644
index e69de29..0000000
--- a/ufund-ui/src/app/login/login.component.css
+++ /dev/null
diff --git a/ufund-ui/src/app/login/login.component.html b/ufund-ui/src/app/login/login.component.html
deleted file mode 100644
index 147cfc4..0000000
--- a/ufund-ui/src/app/login/login.component.html
+++ /dev/null
@@ -1 +0,0 @@
-<p>login works!</p>
diff --git a/ufund-ui/src/app/models/Need.ts b/ufund-ui/src/app/models/Need.ts
new file mode 100644
index 0000000..607a6a7
--- /dev/null
+++ b/ufund-ui/src/app/models/Need.ts
@@ -0,0 +1,13 @@
+export interface Need {
+ name: string,
+ id: number,
+ filterAttributes: String[],
+ type: GoalType;
+ maxGoal: number;
+ current: number;
+}
+
+enum GoalType {
+ MONETARY,
+ PHYSICAL
+}
diff --git a/ufund-ui/src/app/models/User.ts b/ufund-ui/src/app/models/User.ts
new file mode 100644
index 0000000..46fe4a1
--- /dev/null
+++ b/ufund-ui/src/app/models/User.ts
@@ -0,0 +1,6 @@
+import {Need} from './Need';
+
+export interface User {
+ username: string;
+ cupboard: Need[];
+}
diff --git a/ufund-ui/src/app/services/cupboard.service.spec.ts b/ufund-ui/src/app/services/cupboard.service.spec.ts
new file mode 100644
index 0000000..56da56d
--- /dev/null
+++ b/ufund-ui/src/app/services/cupboard.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { CupboardService } from './cupboard.service';
+
+describe('CupboardService', () => {
+ let service: CupboardService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(CupboardService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/ufund-ui/src/app/services/cupboard.service.ts b/ufund-ui/src/app/services/cupboard.service.ts
new file mode 100644
index 0000000..6e2671a
--- /dev/null
+++ b/ufund-ui/src/app/services/cupboard.service.ts
@@ -0,0 +1,44 @@
+import {Injectable} from '@angular/core';
+import {HttpClient, HttpHeaders} from '@angular/common/http';
+import {Need} from '../models/Need';
+import {Observable} from 'rxjs';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class CupboardService {
+
+ private url = "localhost:8080/cupboard"
+ private httpOptions = {
+ headers: new HttpHeaders({'Content-Type': 'application/json'})
+ };
+
+ constructor(
+ private http: HttpClient
+ ) {}
+
+ createNeed(need: Need): Observable<boolean> {
+ return this.http.post<boolean>(
+ this.url, need, this.httpOptions)
+ }
+
+ getNeeds(): Observable<Need[]> {
+ return this.http.get<Need[]>(this.url, this.httpOptions)
+ }
+
+ searchNeeds(name: String): Observable<Need[]> {
+ return this.http.get<Need[]>(`${this.url}/?name=${name}`, this.httpOptions)
+ }
+
+ getNeed(id: number): Observable<Need> {
+ return this.http.get<Need>(`${this.url}/${id}`, this.httpOptions)
+ }
+
+ updateNeed(id: number, data: Need): Observable<boolean> {
+ return this.http.put<boolean>(`${this.url}/${id}`, data, this.httpOptions)
+ }
+
+ deleteNeed(id: number): Observable<boolean> {
+ return this.http.put<boolean>(`${this.url}/${id}`, this.httpOptions)
+ }
+}
diff --git a/ufund-ui/src/app/services/users.service.spec.ts b/ufund-ui/src/app/services/users.service.spec.ts
new file mode 100644
index 0000000..f81244a
--- /dev/null
+++ b/ufund-ui/src/app/services/users.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { UsersService } from './users.service';
+
+describe('UsersService', () => {
+ let service: UsersService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(UsersService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/ufund-ui/src/app/services/users.service.ts b/ufund-ui/src/app/services/users.service.ts
new file mode 100644
index 0000000..65a9e61
--- /dev/null
+++ b/ufund-ui/src/app/services/users.service.ts
@@ -0,0 +1,35 @@
+import { Injectable } from '@angular/core';
+import {HttpClient, HttpHeaders} from '@angular/common/http';
+import {Observable} from 'rxjs';
+import {User} from '../models/User';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class UsersService {
+
+ private url = "localhost:8080/cupboard"
+ private httpOptions = {
+ headers: new HttpHeaders({'Content-Type': 'application/json'})
+ };
+
+ constructor(
+ private http: HttpClient
+ ) {}
+
+ createUser(data: User): Observable<User> {
+ return this.http.post<User>(this.url, data, this.httpOptions)
+ }
+
+ getUser(id: number): Observable<User> {
+ return this.http.get<User>(`${this.url}/${id}`, this.httpOptions)
+ }
+
+ updateUser(id: number): Observable<User> {
+ return this.http.put<User>(`${this.url}/${id}`, this.httpOptions)
+ }
+
+ deleteUser(id: number): Observable<boolean> {
+ return this.http.delete<boolean>(`${this.url}/${id}`, this.httpOptions)
+ }
+}