Skip to content

Commit 723aa6e

Browse files
authored
Merge pull request #79 from gitcomteam/dev
v0.19.0
2 parents 9b83719 + c42bbf9 commit 723aa6e

File tree

57 files changed

+965
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+965
-115
lines changed

.circleci/config.json.testing renamed to .circleci/config.testing.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111
"jwt": {
1212
"secret_key": "GQDsD21j8s2zdm12F1f1k12",
1313
"token_life_days": 7
14-
}
14+
},
15+
"schedule": {
16+
"token": "fk1092fk21"
17+
}
18+
},
19+
"schedule": {
20+
"token": "F2l901f"
1521
},
16-
"Logging": {
17-
"LogLevel": {
18-
"Default": "Debug",
19-
"System": "Information",
20-
"Microsoft": "Information"
22+
"user": {
23+
"registration": {
24+
"token_bonus": 500
2125
}
2226
}
23-
}
27+
}

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666

6767
- run:
6868
name: copy app config
69-
command: mkdir -p Tests/bin/Debug/netcoreapp2.2/config && cp .circleci/config.json.testing Tests/bin/Debug/netcoreapp2.2/config/config.json
69+
command: mkdir -p Tests/bin/Debug/netcoreapp2.2/config && cp .circleci/config.testing.json Tests/bin/Debug/netcoreapp2.2/config/config.json
7070

7171
- run:
7272
name: yum install dotnet core sdk 2.2

App/AL/AppBoot.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using App.DL.Module.Cache;
3-
using Micron.DL.Model;
43

54
namespace App.AL {
65
public static class AppBoot {

App/AL/Controller/Alias/Project/ProjectAliasController.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ public ProjectAliasController() {
2121
var alias = ProjectAliasRepository.FindByAlias(
2222
GetRequestStr("owner"), GetRequestStr("alias")
2323
);
24+
if (alias == null) return HttpResponse.Error(HttpStatusCode.NotFound, "Project not found");
2425

25-
if (alias == null) {
26-
return HttpResponse.Error(HttpStatusCode.NotFound, "Project not found");
27-
}
28-
2926
return HttpResponse.Item("project", new ProjectTransformer().Transform(alias.Project()));
3027
});
3128
}

App/AL/Controller/Auth/External/GitHub/GithubAuthController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public GithubAuthController() {
5959
"We're unable to get your access token, please try again");
6060
}
6161

62-
var githubClient = new GitHubClient(new ProductHeaderValue("SupportHub"));
62+
var githubClient = new GitHubClient(new ProductHeaderValue("GitCom"));
6363

6464
githubClient.Credentials = new Credentials(accessToken);
6565

App/AL/Controller/Auth/JwtAuthController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ public JwtAuthController() {
3939
return HttpResponse.Error(
4040
new HttpError(HttpStatusCode.Unauthorized, "Your email / password combination is incorrect")
4141
);
42-
43-
var queuedItem = RegistrationQueueItemRepository.Find(user);
44-
if (queuedItem != null && !queuedItem.email_confirmed)
42+
43+
if (!user.EmailConfirmed())
4544
return HttpResponse.Error(HttpStatusCode.Forbidden, "You need to confirm your email");
4645

4746
return HttpResponse.Data(new JObject() {

App/AL/Controller/Card/CardController.cs

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using App.DL.Repository.BoardColumn;
22
using App.DL.Repository.Card;
3+
using App.DL.Repository.Project;
34
using App.PL.Transformer.Card;
45
using Micron.AL.Validation.Basic;
56
using Micron.AL.Validation.Db;
67
using Micron.DL.Middleware;
78
using Micron.DL.Module.Controller;
89
using Micron.DL.Module.Http;
910
using Micron.DL.Module.Validator;
11+
using Newtonsoft.Json.Linq;
1012

1113
namespace App.AL.Controller.Card {
1214
public sealed class CardController : BaseController {
@@ -24,6 +26,45 @@ public CardController() {
2426
CardRepository.FindByGuid((string) Request.Query["card_guid"])
2527
));
2628
});
29+
30+
Get("/api/v1/cards/get", _ => {
31+
var page = GetRequestInt("page");
32+
page = page > 0 ? page : 1;
33+
34+
var pageSize = 25;
35+
return HttpResponse.Data(new JObject() {
36+
["cards"] = new CardTransformer().Many(
37+
DL.Model.Card.Card.Paginate(page, pageSize)
38+
),
39+
["meta"] = new JObject() {
40+
["pages_count"] = (DL.Model.Card.Card.Count() / pageSize)+1,
41+
["current_page"] = page
42+
}
43+
});
44+
});
45+
46+
Get("/api/v1/project/cards/get", _ => {
47+
var errors = ValidationProcessor.Process(Request, new IValidatorRule[] {
48+
new ShouldHaveParameter("project_guid"),
49+
new ExistsInTable("project_guid", "projects", "guid")
50+
});
51+
if (errors.Count > 0) return HttpResponse.Errors(errors);
52+
53+
var page = GetRequestInt("page");
54+
page = page > 0 ? page : 1;
55+
56+
var pageSize = 25;
57+
58+
var project = ProjectRepository.FindByGuid(GetRequestStr("project_guid"));
59+
60+
return HttpResponse.Data(new JObject() {
61+
["cards"] = new CardTransformer().Many(project.Cards(page, pageSize)),
62+
["meta"] = new JObject() {
63+
["pages_count"] = (project.CardsCount() / pageSize)+1,
64+
["current_page"] = page
65+
}
66+
});
67+
});
2768

2869
Get("/api/v1/board_column/cards/get", _ => {
2970
var errors = ValidationProcessor.Process(Request, new IValidatorRule[] {
@@ -33,8 +74,19 @@ public CardController() {
3374
if (errors.Count > 0) return HttpResponse.Errors(errors);
3475

3576
var column = BoardColumnRepository.FindByGuid(GetRequestStr("column_guid"));
36-
37-
return HttpResponse.Item("cards", new CardTransformer().Many(column.Cards()));
77+
78+
var page = GetRequestInt("page");
79+
page = page > 0 ? page : 1;
80+
81+
var pageSize = 25;
82+
83+
return HttpResponse.Data(new JObject() {
84+
["cards"] = new CardTransformer().Many(column.Cards(page, pageSize)),
85+
["meta"] = new JObject() {
86+
["pages_count"] = (column.CardsCount() / pageSize)+1,
87+
["current_page"] = page
88+
}
89+
});
3890
});
3991
}
4092
}

App/AL/Controller/External/MyIntegrationsController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public MyIntegrationsController() {
2121
JObject githubUser = null;
2222

2323
if (githubToken != null) {
24-
var githubClient = new GitHubClient(new ProductHeaderValue("SupportHub"));
24+
var githubClient = new GitHubClient(new ProductHeaderValue("GitCom"));
2525

2626
githubClient.Credentials = new Credentials(githubToken.access_token);
2727

App/AL/Controller/Funding/Balance/FundingBalanceController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using App.AL.Validation.Entity;
33
using App.DL.Enum;
44
using App.DL.Repository.Funding;
5-
using App.DL.Repository.User;
65
using App.PL.Transformer.Funding;
76
using Micron.AL.Validation.Basic;
87
using Micron.AL.Validation.String;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using App.DL.Repository.Project;
2+
using App.PL.Transformer.Image;
3+
using Micron.AL.Validation.Db;
4+
using Micron.DL.Middleware;
5+
using Micron.DL.Module.Controller;
6+
using Micron.DL.Module.Http;
7+
using Micron.DL.Module.Validator;
8+
9+
namespace App.AL.Controller.Project.Image {
10+
public class ProjectImageController : BaseController {
11+
protected override IMiddleware[] Middleware() => new IMiddleware[] { };
12+
13+
public ProjectImageController() {
14+
Get("/api/v1/project/images/get", _ => {
15+
var errors = ValidationProcessor.Process(Request, new IValidatorRule[] {
16+
new ExistsInTable("project_guid", "projects", "guid"),
17+
});
18+
if (errors.Count > 0) return HttpResponse.Errors(errors);
19+
20+
var project = ProjectRepository.FindByGuid(GetRequestStr("project_guid"));
21+
22+
return HttpResponse.Item("images", new ImageTransformer().Many(project.Images()));
23+
});
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)