Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Coscine
backend
apis
Pid
Commits
ea3d0776
Commit
ea3d0776
authored
Dec 17, 2020
by
Sandra Westerhoff
Browse files
Update: Owner of a project can be contacted (coscine/issues#1202)
parent
09e990ac
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Pid/Controllers/PidController.cs
View file @
ea3d0776
...
...
@@ -24,6 +24,7 @@ namespace Coscine.Api.Pid.Controllers
public
class
PidController
:
Controller
{
private
readonly
ResourceModel
_resourceModel
;
private
readonly
ProjectModel
_projectModel
;
private
readonly
IConfiguration
_configuration
;
private
readonly
Emitter
_emitter
;
...
...
@@ -35,6 +36,7 @@ namespace Coscine.Api.Pid.Controllers
_configuration
=
Program
.
Configuration
;
_emitter
=
new
Emitter
(
this
.
_configuration
);
_resourceModel
=
new
ResourceModel
();
_projectModel
=
new
ProjectModel
();
}
/// <summary>
...
...
@@ -46,6 +48,7 @@ namespace Coscine.Api.Pid.Controllers
public
IActionResult
SendMailToOwner
([
FromBody
]
MessageObject
messageObject
)
{
var
resource
=
_resourceModel
.
GetById
(
new
Guid
(
messageObject
.
Guid
));
var
project
=
_projectModel
.
GetById
(
new
Guid
(
messageObject
.
Guid
));
var
user
=
new
User
()
{
DisplayName
=
messageObject
.
Name
,
...
...
@@ -53,19 +56,31 @@ namespace Coscine.Api.Pid.Controllers
};
var
placeholder
=
new
JObject
()
{
[
"resourceName"
]
=
resource
.
DisplayName
,
[
"requesterName"
]
=
messageObject
.
Name
,
[
"requesterMail"
]
=
messageObject
.
Email
,
[
"requestMessage"
]
=
messageObject
.
Message
,
[
"pid"
]
=
messageObject
.
Pid
};
_emitter
.
EmitPIDOwnerContact
(
new
PIDEventArgs
(
_configuration
)
PIDEventArgs
pidEventArgs
=
new
PIDEventArgs
(
_configuration
)
{
Requester
=
user
,
Resource
=
resource
,
SentCopy
=
messageObject
.
SendCopy
,
Placeholder
=
placeholder
});
};
if
(
resource
!=
null
)
{
placeholder
[
"resourceName"
]
=
resource
.
DisplayName
;
pidEventArgs
.
Resource
=
resource
;
}
else
{
placeholder
[
"projectName"
]
=
project
.
DisplayName
;
pidEventArgs
.
Project
=
project
;
}
_emitter
.
EmitPIDOwnerContact
(
pidEventArgs
);
return
Json
(
new
JObject
{
[
"status"
]
=
"ok"
});
}
}
...
...
src/Pid/Pid.csproj
View file @
ea3d0776
...
...
@@ -51,8 +51,8 @@
<Reference
Include=
"Consul, Version=0.7.2.6, Culture=neutral, PublicKeyToken=20a6ad9a81df1d95, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Consul.0.7.2.6\lib\net45\Consul.dll
</HintPath>
</Reference>
<Reference
Include=
"Coscine.Action, Version=1.1
7
.0.0, Culture=neutral, processorArchitecture=AMD64"
>
<HintPath>
..\packages\Coscine.Action.1.1
7
.0\lib\net461\Coscine.Action.dll
</HintPath>
<Reference
Include=
"Coscine.Action, Version=1.1
8
.0.0, Culture=neutral, processorArchitecture=AMD64"
>
<HintPath>
..\packages\Coscine.Action.1.1
8
.0
-topic-1202-pidap0002
\lib\net461\Coscine.Action.dll
</HintPath>
</Reference>
<Reference
Include=
"Coscine.ApiCommons, Version=1.11.0.0, Culture=neutral, PublicKeyToken=af4c1345df96546b, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Coscine.ApiCommons.1.11.0\lib\net461\Coscine.ApiCommons.dll
</HintPath>
...
...
src/Pid/packages.config
View file @
ea3d0776
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"Consul"
version
=
"0.7.2.6"
targetFramework
=
"net461"
/>
<
package
id
=
"Coscine.Action"
version
=
"1.1
7
.0"
targetFramework
=
"net461"
/>
<
package
id
=
"Coscine.Action"
version
=
"1.1
8
.0
-topic-1202-pidap0002
"
targetFramework
=
"net461"
/>
<
package
id
=
"Coscine.ApiCommons"
version
=
"1.11.0"
targetFramework
=
"net461"
/>
<
package
id
=
"Coscine.Configuration"
version
=
"1.5.0"
targetFramework
=
"net461"
/>
<
package
id
=
"Coscine.Database"
version
=
"1.27.0"
targetFramework
=
"net461"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment