Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arsnova-lite
Manage
Activity
Members
Labels
Plan
Issues
24
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
ARSnova
arsnova-lite
Commits
14094693
Verified
Commit
14094693
authored
7 years ago
by
Lukas Mauß
Committed by
Lukas Maximilian Kimpel
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Enable join room with existing shortId
parent
a7ff5f2d
1 merge request
!87
participant home screen api
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/room.service.ts
+27
-13
27 additions, 13 deletions
src/app/room.service.ts
with
27 additions
and
13 deletions
src/app/room.service.ts
+
27
−
13
View file @
14094693
...
...
@@ -7,20 +7,28 @@ import { ErrorHandlingService } from './error-handling.service';
import
{
AuthenticationService
}
from
'
./authentication.service
'
;
const
httpOptions
=
{
headers
:
new
HttpHeaders
({
'
Content-Type
'
:
'
application/json
'
})
headers
:
new
HttpHeaders
({})
};
@
Injectable
()
export
class
RoomService
extends
ErrorHandlingService
{
private
roomsUrl
=
'
api/rooms
'
;
private
apiBaseUrl
=
'
https://arsnova-staging.mni.thm.de/api
'
;
private
roomsUrl
=
'
/room
'
;
private
findRoomsUrl
=
'
/find
'
;
constructor
(
private
http
:
HttpClient
,
private
authService
:
AuthenticationService
)
{
constructor
(
private
http
:
HttpClient
,
private
authenticationService
:
AuthenticationService
)
{
super
();
}
getRooms
():
Observable
<
Room
[]
>
{
return
this
.
http
.
get
<
Room
[]
>
(
this
.
roomsUrl
).
pipe
(
const
url
=
this
.
apiBaseUrl
+
this
.
roomsUrl
+
this
.
findRoomsUrl
;
return
this
.
http
.
post
<
Room
[]
>
(
url
,
{
properties
:
{},
externalFilters
:
{
inHistoryOfUserId
:
this
.
authService
.
getUser
().
userId
}
}).
pipe
(
tap
(
_
=>
''
),
catchError
(
this
.
handleError
(
'
getRooms
'
,
[]))
);
...
...
@@ -38,31 +46,37 @@ export class RoomService extends ErrorHandlingService {
}
addRoom
(
room
:
Room
):
Observable
<
Room
>
{
return
this
.
http
.
post
<
Room
>
(
this
.
roomsUrl
,
room
,
httpOptions
).
pipe
(
const
connectionUrl
=
this
.
apiBaseUrl
+
this
.
roomsUrl
+
'
/
'
;
return
this
.
http
.
post
<
Room
>
(
connectionUrl
,
{
shortId
:
room
.
shortId
,
ownerId
:
this
.
authService
.
getUser
().
userId
,
abbreviation
:
room
.
abbreviation
,
name
:
room
.
name
,
closed
:
room
.
closed
,
description
:
room
.
description
},
httpOptions
).
pipe
(
tap
(
_
=>
''
),
catchError
(
this
.
handleError
<
Room
>
(
'
addRoom
'
))
);
}
getRoom
(
id
:
string
):
Observable
<
Room
>
{
const
url
=
`
${
this
.
roomsUrl
}
/
${
id
}
`
;
return
this
.
http
.
get
<
Room
>
(
u
rl
).
pipe
(
const
connectionUrl
=
`
${
this
.
apiBaseUrl
}
${
this
.
roomsUrl
}
/
${
id
}
`
;
return
this
.
http
.
get
<
Room
>
(
connectionU
rl
).
pipe
(
catchError
(
this
.
handleError
<
Room
>
(
`getRoom id=
${
id
}
`
))
);
}
updateRoom
(
room
:
Room
):
Observable
<
any
>
{
return
this
.
http
.
put
(
this
.
roomsUrl
,
room
,
httpOptions
).
pipe
(
updateRoom
(
room
:
Room
):
Observable
<
Room
>
{
const
connectionUrl
=
`
${
this
.
apiBaseUrl
}${
this
.
roomsUrl
}
/
${
room
.
id
}
`
;
return
this
.
http
.
put
(
connectionUrl
,
{
shortId
:
room
.
shortId
,
ownerId
:
this
.
authService
.
getUser
().
userId
,
abbreviation
:
room
.
abbreviation
,
name
:
room
.
name
,
closed
:
room
.
closed
,
description
:
room
.
description
},
httpOptions
).
pipe
(
tap
(
_
=>
''
),
catchError
(
this
.
handleError
<
any
>
(
'
updateRoom
'
))
);
}
deleteRoom
(
room
:
Room
|
string
):
Observable
<
Room
>
{
const
id
=
typeof
room
===
'
string
'
?
room
:
room
.
id
;
const
url
=
`
${
this
.
roomsUrl
}
/
${
id
}
`
;
return
this
.
http
.
delete
<
Room
>
(
url
,
httpOptions
).
pipe
(
deleteRoom
(
room
:
Room
):
Observable
<
Room
>
{
const
connectionUrl
=
`
${
this
.
apiBaseUrl
}${
this
.
roomsUrl
}
/
${
room
.
id
}
`
;
return
this
.
http
.
delete
<
Room
>
(
connectionUrl
,
httpOptions
).
pipe
(
tap
(
_
=>
''
),
catchError
(
this
.
handleError
<
Room
>
(
'
deleteRoom
'
))
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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