Skip to content

Commit

Permalink
Merge pull request #44 from SSWConsulting/add-test
Browse files Browse the repository at this point in the history
✨ Update .http File For Manual Testing
  • Loading branch information
Aibono1225 authored Dec 25, 2023
2 parents 5109994 + 95a89c9 commit fd6fa1f
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ public async Task<HttpResponseData> Run(
var results =
await dbContext.Bookmarks.Query(q => q.Where(w => w.RuleGuid == data.RuleGuid && w.UserId == data.UserId));

var environment = Environment.GetEnvironmentVariable("AZURE_FUNCTIONS_ENVIRONMENT");

var model = results.FirstOrDefault();

if (model == null)
{
var response = await dbContext.Bookmarks.Add(data);
if (response.IsDefined())
if (environment.Equals("Development", StringComparison.OrdinalIgnoreCase) || response.IsDefined())
{
model = response;
_logger.LogInformation("Added new bookmark on rule. Id: {0}", model.Id);
Expand Down
149 changes: 149 additions & 0 deletions SSW.Rules.AzFuncs/docs/Functions/Functions.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
@BaseApiUrl = http://localhost:7248/api
@Token
@RuleGuid
@UserId
@CommentsUserId
@OrganisationId

# Health
GET {{BaseApiUrl}}/HealthCheckFunction

###
# History - Generate
GET {{BaseApiUrl}}/GenerateHistoryFileFunction

###
# History - SyncCommitHash
GET {{BaseApiUrl}}/GetHistorySyncCommitHash

###
# Widget - Get LatestRules (with GitHub)
@skip = 0
@take = 10
@githubUsername = "BrookJeynes"

GET {{BaseApiUrl}}/GetLatestRules?skip={{skip}}&take={{take}}&githubUsername={{githubUsername}}
# Content-Type: application/json

###
# Widget - Get LatestRules (No GitHub)

GET {{BaseApiUrl}}/GetLatestRules?skip={{skip}}&take={{take}}

###
# Reactions - ReactFunction
POST {{BaseApiUrl}}/ReactFunction
Content-Type: application/json
Authorization: Bearer {{Token}}

{
"type": 3,
"ruleGuid": "{{RuleGuid}}",
"userId": "{{UserId}}"
}

###
# Reactions - RemoveReactionFunction
POST {{BaseApiUrl}}/RemoveReactionFunction
Content-Type: application/json
Authorization: Bearer {{Token}}

{
"type": 3,
"ruleGuid": "{{RuleGuid}}",
"userId": "{{UserId}}"
}

###
# Reactions - GetReactionsFunction
GET {{BaseApiUrl}}/GetReactionsFunction?rule_guid={{RuleGuid}}&user_id={{UserId}}

###
# Reactions - GetAllReactionsFunction
GET {{BaseApiUrl}}/GetAllReactionsFunction?user_id={{UserId}}

###
# CMSAuth - AuthenticateCms
GET {{BaseApiUrl}}/auth?scope=public_repo

###
# CMSAuth - NetlifyCallback
@code = 14bb17d5408e68e4b220
GET {{BaseApiUrl}}/callback?code={{code}}

###
# Bookmark - BookmarkRuleFunction
POST {{BaseApiUrl}}/BookmarkRuleFunction
Content-Type: application/json
Authorization: Bearer {{Token}}

{
"RuleGuid": "{{RuleGuid}}",
"UserId": "{{UserId}}"
}

###
# Bookmark - RemoveBookmarkFunction
POST {{BaseApiUrl}}/RemoveBookmarkFunction
Content-Type: application/json
Authorization: Bearer {{Token}}

{
"RuleGuid": "{{RuleGuid}}",
"UserId": "{{UserId}}"
}

###
# Bookmark - GetAllBookmarkedFunction
GET {{BaseApiUrl}}/GetAllBookmarkedFunction?user_id={{UserId}}

###
# Bookmark - GetBookmarkStatusFunction
GET {{BaseApiUrl}}/GetBookmarkStatusFunction?rule_guid={{RuleGuid}}&user_id={{UserId}}

###
# SecretContent - GetSecretContentFunction
GET {{BaseApiUrl}}/GetSecretContentFunction?id=cc4e043f-60e2-4f99-b9ee-b2518c3004a8
Authorization: Bearer {{Token}}

###
# User - GetUserFunction
GET {{BaseApiUrl}}/GetUserFunction?user_id={{UserId}}
Authorization: Bearer {{Token}}

###
# User - GetOrganisationsFunction
GET {{BaseApiUrl}}/GetOrganisationsFunction?user_id={{UserId}}
Authorization: Bearer {{Token}}

###
# User - AddUserOrganisationFunction
POST {{BaseApiUrl}}/AddUserOrganisationFunction
Content-Type: application/json
Authorization: Bearer {{Token}}

{
"OrganisationId": "{{OrganisationId}}",
"UserId": "{{UserId}}"
}

###
# User - RemoveUserCommentsAccountFunction
POST {{BaseApiUrl}}/RemoveUserCommentsAccountFunction
Content-Type: application/json
Authorization: Bearer {{Token}}

{
"UserId": "{{UserId}}"
}

###
# User - ConnectUserToCommentsFunction
POST {{BaseApiUrl}}/ConnectUserToCommentsFunction
Content-Type: application/json
Authorization: Bearer {{Token}}

{
"UserId": "{{UserId}}",
"CommentsUserId": "{{CommentsUserId}}"
}

0 comments on commit fd6fa1f

Please sign in to comment.