Skip to content

Commit

Permalink
🔧 feat(membership-service): Implement PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
orazefabian committed May 14, 2024
1 parent 09d6fe6 commit 192b1ae
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
18 changes: 16 additions & 2 deletions src/membership-service/Controllers/MembershipController.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// <copyright company="Dynatrace LLC">
// Copyright 2024 Dynatrace LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System;
using System.Data;
using System.Net;
Expand Down Expand Up @@ -36,7 +52,6 @@ public async Task<IActionResult> GetMembershipStatus(string userid)

string selectQuery = "SELECT membership FROM membership WHERE userid = " + userid;


_logger.LogInformation($"Executing query: {selectQuery}");

using (var selectCmd = new MySqlCommand(selectQuery, connection))
Expand Down Expand Up @@ -91,7 +106,6 @@ public async Task<IActionResult> SetMembershipStatus(string userid, [FromForm(Na

string query = "INSERT INTO membership (userid, membership) VALUES (" + userid + ",\"" + membership + "\") ON DUPLICATE KEY UPDATE membership = \"" + membership + "\"";


_logger.LogInformation($"Executing query: {query}");


Expand Down
16 changes: 16 additions & 0 deletions src/membership-service/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// <copyright company="Dynatrace LLC">
// Copyright 2024 Dynatrace LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
Expand Down
2 changes: 1 addition & 1 deletion src/membership-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Returns the current membership of the requested user ID.

#### POST /membership-service/add/{userid}

Update the user membership by providing it as simple form params to the post request:
Update the user membership by providing it as simple form parameter to the post request:

```
membership={membershipText}
Expand Down
18 changes: 16 additions & 2 deletions src/membership-service/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// <copyright company="Dynatrace LLC">
// Copyright 2024 Dynatrace LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -38,8 +54,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

app.UseRouting();

app.UseCors("AllowOrigin");

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
Expand Down

0 comments on commit 192b1ae

Please sign in to comment.