Parcourir la source

updated entity classes

Rachelle il y a 6 ans
Parent
révision
0f80a1ae07

+ 5
- 0
MyPassionProject/pom.xml Voir le fichier

@@ -33,6 +33,11 @@
33 33
 			<groupId>org.springframework.boot</groupId>
34 34
 			<artifactId>spring-boot-starter-data-rest</artifactId>
35 35
 		</dependency>
36
+
37
+		<dependency>
38
+			<groupId>org.projectlombok</groupId>
39
+			<artifactId>lombok</artifactId>
40
+		</dependency>
36 41
 		<dependency>
37 42
 			<groupId>org.springframework.boot</groupId>
38 43
 			<artifactId>spring-boot-starter-web</artifactId>

+ 3
- 21
MyPassionProject/src/main/java/com/example/demo/Entity/Game.java Voir le fichier

@@ -1,34 +1,16 @@
1 1
 package com.example.demo.Entity;
2
-
2
+import lombok.Getter;
3
+import lombok.Setter;
3 4
 
4 5
 import javax.persistence.*;
5 6
 
6 7
 @Entity
7 8
 @Table(uniqueConstraints={@UniqueConstraint(columnNames={"name"})})
9
+@Setter @Getter
8 10
 public class Game {
9 11
   private String name;
10 12
   @Id
11 13
   @GeneratedValue(strategy = GenerationType.IDENTITY)
12 14
   private long id;
13 15
   private String description;
14
-
15
-  public long getId() {
16
-    return id;
17
-  }
18
-
19
-  public String getName() {
20
-    return name;
21
-  }
22
-
23
-  public void setName(String name) {
24
-    this.name = name;
25
-  }
26
-
27
-  public String getDescription() {
28
-    return description;
29
-  }
30
-
31
-  public void setDescription(String description) {
32
-    this.description = description;
33
-  }
34 16
 }

+ 4
- 38
MyPassionProject/src/main/java/com/example/demo/Entity/User.java Voir le fichier

@@ -1,10 +1,13 @@
1 1
 package com.example.demo.Entity;
2 2
 
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
3 6
 import javax.persistence.*;
4 7
 import java.util.HashSet;
5 8
 import java.util.Set;
6 9
 
7
-@Entity
10
+@Entity @Getter @Setter
8 11
 public class User {
9 12
 
10 13
     @Id
@@ -25,43 +28,6 @@ public class User {
25 28
             inverseJoinColumns = {@JoinColumn(name = "game_id")})
26 29
     private Set<Game> gameLibrary;
27 30
 
28
-    public long getId() {
29
-        return id;
30
-    }
31
-
32
-    public String getSummary() {
33
-        return summary;
34
-    }
35
-
36
-    public void setSummary(String summary) {
37
-        this.summary = summary;
38
-    }
39
-
40
-    public String getProfileName() {
41
-        return profileName;
42
-    }
43
-
44
-    public void setProfileName(String profileName) {
45
-        this.profileName = profileName;
46
-    }
47
-
48
-    public String getUserName() {
49
-        return userName;
50
-    }
51
-
52
-    public void setUserName(String userName) {
53
-        this.userName = userName;
54
-    }
55
-
56
-
57
-    public Set<Game> getGameLibrary() {
58
-        return gameLibrary;
59
-    }
60
-
61
-    public void setGameLibrary(Set<Game> gameLibrary) {
62
-        this.gameLibrary = gameLibrary;
63
-    }
64
-
65 31
     public void addGames(Game game){
66 32
         if(gameLibrary==null){
67 33
             this.gameLibrary = new HashSet<Game>();

+ 3
- 3
MyPassionProjectClient/src/pages/friends/friends.html Voir le fichier

@@ -14,15 +14,15 @@
14 14
 
15 15
 <ion-content padding>
16 16
 
17
-  <ion-searchbar></ion-searchbar>
17
+  <ion-searchbar placeholder="Search People"></ion-searchbar>
18 18
   <ion-list>
19 19
     <ion-item-sliding>
20 20
       <ion-item>
21 21
         <ion-thumbnail item-start>
22
-          <img src="img/thumbnail-totoro.png">
22
+          <img src="">
23 23
         </ion-thumbnail>
24 24
         <h2>SpiderMango</h2>
25
-        <p>Nafear</p>
25
+        <p>Nafis has no Nafear</p>
26 26
         <button ion-button clear item-end>View</button>
27 27
       </ion-item>
28 28
 

+ 6
- 5
MyPassionProjectClient/src/pages/games/games.html Voir le fichier

@@ -12,18 +12,19 @@
12 12
 
13 13
 <ion-content padding>
14 14
 
15
-  <ion-searchbar (ionInput)="getItems($event)"></ion-searchbar>
15
+  <ion-searchbar (ionInput)="getItems($event)" placeholder="Search Games"></ion-searchbar>
16 16
   <ion-list>
17
-    <ion-item-sliding>
17
+    <ion-item-sliding *ngFor="let item of items">
18 18
       <ion-item>
19 19
       <ion-thumbnail item-start>
20
-        <img src="img/thumbnail-totoro.png">
20
+        <img src="">
21 21
       </ion-thumbnail>
22
-      <h2>My Neighbor Totoro</h2>
23
-      <p>Hayao Miyazaki • 1988</p>
22
+      <h2>{{item.name}}</h2>
23
+      <p>{{item.description}}</p>
24 24
       <button ion-button clear item-end>View</button>
25 25
         </ion-item>
26 26
 
27
+
27 28
       <ion-item-options side="left">
28 29
         <button ion-button color="primary" (click)="doAddToOwnedAndPlayedList()">
29 30
           <ion-icon name="add"></ion-icon> Owned and Played

+ 21
- 9
MyPassionProjectClient/src/pages/games/games.ts Voir le fichier

@@ -1,6 +1,14 @@
1 1
 import { Component } from '@angular/core';
2 2
 import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
3 3
 
4
+class item {
5
+  name: string;
6
+  description: string;
7
+
8
+  constructor(name: string, description: string){this.name = name; this.description = description}
9
+
10
+}
11
+
4 12
 /**
5 13
  * Generated class for the GamesPage page.
6 14
  *
@@ -15,7 +23,7 @@ import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angula
15 23
 })
16 24
 export class GamesPage {
17 25
   searchQuery: string = '';
18
-  items: string[];
26
+  items: item[];
19 27
 
20 28
   constructor(public navCtrl: NavController, public navParams: NavParams, public toastCtrl: ToastController,) {
21 29
     this.initializeItems();
@@ -52,10 +60,14 @@ export class GamesPage {
52 60
   }
53 61
 
54 62
   initializeItems() {
63
+    let item1 = new item('Agricola','Lookout Games • 2007');
64
+    let item2 = new item('Catan','KOSMOS • 1995');
65
+    let item3 = new item('Magic: The Gathering','Wizards of the Coast • 1993');
66
+
55 67
     this.items = [
56
-      'Agricola',
57
-      'Catan',
58
-      'Magic'
68
+      item1,
69
+      item2,
70
+      item3
59 71
     ];
60 72
   }
61 73
 
@@ -67,11 +79,11 @@ export class GamesPage {
67 79
     const val = ev.target.value;
68 80
 
69 81
     // if the value is an empty string don't filter the items
70
-    if (val && val.trim() != '') {
71
-      this.items = this.items.filter((item) => {
72
-        return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
73
-      })
74
-    }
82
+    // if (val && val.trim() != '') {
83
+    //   this.items = this.items.filter((item) => {
84
+    //     return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
85
+    //   })
86
+    // }
75 87
   }
76 88
 
77 89
 

+ 6
- 6
MyPassionProjectClient/src/pages/profile/profile.html Voir le fichier

@@ -25,7 +25,7 @@
25 25
       <strong>My Profile</strong>
26 26
     </ion-card-header>
27 27
 
28
-    <img src="img/nin-live.png"/>
28
+    <img src="img.png"/>
29 29
 
30 30
     <ion-card-content>
31 31
       <ion-card-title>
@@ -46,24 +46,24 @@
46 46
 
47 47
     <ion-card-content>
48 48
       <ion-card-title>
49
-        Descent
49
+        Descent: Journeys in the Dark
50 50
       </ion-card-title>
51 51
       <p>
52
-        Cooperative, Character-Building
52
+        Adventure, Modular Board
53 53
       </p>
54 54
 
55 55
       <ion-card-title>
56 56
         Dominion
57 57
       </ion-card-title>
58 58
       <p>
59
-        Deck-Builder, Strategy
59
+        Strategy, Deck-Builder
60 60
       </p>
61 61
 
62 62
       <ion-card-title>
63
-        SushiGo
63
+        Sushi Go!
64 64
       </ion-card-title>
65 65
       <p>
66
-        Pass the Trash, New-Player Friendly
66
+        Family, Card Drafting
67 67
       </p>
68 68
     </ion-card-content>
69 69