Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SAE4.A02.1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maxime Gosselin
SAE4.A02.1
Commits
340ddd5d
Commit
340ddd5d
authored
2 months ago
by
Florine Lefebvre
Browse files
Options
Downloads
Patches
Plain Diff
suppression de thread en cascade
parent
ade06394
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
WEB-INF/src/controleur/ThreadController.java
+6
-0
6 additions, 0 deletions
WEB-INF/src/controleur/ThreadController.java
WEB-INF/vue/compte.jsp
+1
-1
1 addition, 1 deletion
WEB-INF/vue/compte.jsp
baseDeDonnee/init.sql
+2
-3
2 additions, 3 deletions
baseDeDonnee/init.sql
with
9 additions
and
4 deletions
WEB-INF/src/controleur/ThreadController.java
+
6
−
0
View file @
340ddd5d
...
...
@@ -8,6 +8,7 @@ import jakarta.servlet.http.HttpServlet;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
modele.dao.DaoFollower
;
import
modele.dao.DaoThread
;
import
modele.dto.Follower
;
@WebServlet
(
"/thread"
)
...
...
@@ -23,6 +24,7 @@ public class ThreadController extends HttpServlet {
String
action
=
(
String
)
req
.
getParameter
(
"action"
);
String
vue
;
DaoFollower
daoFollower
=
new
DaoFollower
();
DaoThread
daoThread
=
new
DaoThread
();
int
idThread
=
Integer
.
parseInt
(
req
.
getParameter
(
"id"
));
Follower
follow
=
new
Follower
(
username
,
idThread
);
...
...
@@ -39,6 +41,10 @@ public class ThreadController extends HttpServlet {
daoFollower
.
delete
(
follow
);
vue
=
"WEB-INF/vue/filsSuivis.jsp"
;
break
;
case
"delete"
:
daoThread
.
delete
(
idThread
);
vue
=
"WEB-INF/vue/accueil.jsp"
;
break
;
default
:
vue
=
"WEB-INF/vue/fils.jsp"
;
}
...
...
This diff is collapsed.
Click to expand it.
WEB-INF/vue/compte.jsp
+
1
−
1
View file @
340ddd5d
...
...
@@ -113,7 +113,7 @@
</div>
<div
class=
"d-flex"
>
<a
class=
"me-3 align-self-center btn btn-primary"
href=
"?chat=
<%=
thread
.
getId_thread
()
%>
"
>
Ouvrir
<i
class=
"bi-chat-fill"
></i></a>
<a
class=
"me-3 align-self-center btn btn-danger"
href=
"
?
delete=
<%=
thread
.
getId_thread
()
%>
"
>
Supprimer
<i
class=
"bi-x-circle-fill"
></i></a>
<a
class=
"me-3 align-self-center btn btn-danger"
href=
"
thread?action=
delete
&id
=
<%=
thread
.
getId_thread
()
%>
"
>
Supprimer
<i
class=
"bi-x-circle-fill"
></i></a>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
baseDeDonnee/init.sql
+
2
−
3
View file @
340ddd5d
DROP
TABLE
IF
EXISTS
followers
;
DROP
TABLE
IF
EXISTS
messages
;
DROP
TABLE
IF
EXISTS
followers
;
DROP
TABLE
IF
EXISTS
threads
;
DROP
TABLE
IF
EXISTS
users
;
...
...
@@ -26,7 +25,7 @@ CREATE TABLE followers (
PRIMARY
KEY
(
username
,
id_thread
),
FOREIGN
KEY
(
username
)
REFERENCES
users
(
username
),
FOREIGN
KEY
(
id_thread
)
REFERENCES
threads
(
id_thread
)
FOREIGN
KEY
(
id_thread
)
REFERENCES
threads
(
id_thread
)
ON
DELETE
CASCADE
);
CREATE
TABLE
messages
(
...
...
@@ -37,6 +36,6 @@ CREATE TABLE messages (
time
TIMESTAMP
WITH
TIME
ZONE
,
FOREIGN
KEY
(
sender
)
REFERENCES
users
(
username
),
FOREIGN
KEY
(
id_thread
)
REFERENCES
threads
(
id_thread
)
FOREIGN
KEY
(
id_thread
)
REFERENCES
threads
(
id_thread
)
ON
DELETE
CASCADE
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment