Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
1d3de42
feat: add volume to docker compose file (#99)
kaitoz11 May 26, 2023
fea4381
Cross cutting/auth (#100)
ChienNQuang May 26, 2023
ffc92cd
Cross cutting/auth (#101)
ChienNQuang May 26, 2023
5c6367a
add: expiry date of jwe to be the same with refresh tokne
ChienNQuang May 26, 2023
4f8a653
Cross cutting/auth (#102)
ChienNQuang May 26, 2023
98a5cb6
Cross cutting/auth (#103)
ChienNQuang May 26, 2023
16e8a0b
update: refresh and login endpoint now delete db refresh tokens and r…
ChienNQuang May 26, 2023
5a9877b
Fix/logout (#106)
ChienNQuang May 27, 2023
11ecf16
Cuong/refactor (#105)
kaitoz11 May 27, 2023
9bfc699
Update/auth mechanism (#107)
ChienNQuang May 27, 2023
7cf694c
Add/queries commands (#108)
ChienNQuang May 27, 2023
e213080
Refactor/baseline (#109)
ChienNQuang May 29, 2023
b909473
feat: Create codeql.yml (#110)
kaitoz11 May 29, 2023
5f62bb5
Feat/get room by ID (#114)
vzart May 29, 2023
55d642e
Feat/enable room (#112)
vzart May 29, 2023
1f127b8
Feat/remove locker (#135)
StarryFolf May 31, 2023
c0f6601
Feat/update locker (#136)
StarryFolf May 31, 2023
e07ed26
Feat/get all folders paginated (#134)
ChienNQuang Jun 1, 2023
c53cf77
fix/get all folders paginated (#139)
ChienNQuang Jun 1, 2023
94402aa
Feat/get folder by Id (#140)
kaitoz11 Jun 1, 2023
22aebca
Feat/get user by Id (#117)
vzart Jun 1, 2023
7dc19a1
Feat/update user (#120)
vzart Jun 1, 2023
dfe1a85
feat: get all rooms paginated (#132)
ChienNQuang Jun 1, 2023
04de936
Feat/update room (#115)
vzart Jun 1, 2023
4e2864d
feat: get all lockers integration tests and implementation (#133)
ChienNQuang Jun 1, 2023
e99b63c
Feat/remove staff (#142)
vzart Jun 1, 2023
ab96896
Feat/get department by id (#154)
StarryFolf Jun 1, 2023
e65e727
Feat/get locker by id (#155)
StarryFolf Jun 1, 2023
8d54105
Feat/update folder (#158)
kaitoz11 Jun 1, 2023
f0f6183
Feat/remove folder (#141)
kaitoz11 Jun 1, 2023
50801d8
fix: paginations (#161)
ChienNQuang Jun 2, 2023
4085748
Feat/enable folder (#144)
kaitoz11 Jun 2, 2023
a7e9193
feat: remove user from room + tests (#156)
vzart Jun 2, 2023
4df6d61
Feat/reset password email (#145)
ChienNQuang Jun 2, 2023
10e786e
feat: get staff by room + tests (#151)
vzart Jun 2, 2023
6f2d1d1
add: integration test and implementation (#138)
ChienNQuang Jun 2, 2023
207b954
Feat/get all documents (#137)
ChienNQuang Jun 2, 2023
c4de1cc
fix: import document (#168)
ChienNQuang Jun 2, 2023
5d0b657
Feat/delete document (#163)
kaitoz11 Jun 2, 2023
31e488c
feat: get staff by id (#173)
vzart Jun 3, 2023
ddf6f52
Feat/borrow (#159)
ChienNQuang Jun 3, 2023
d66ba0e
Feat/get all staffs paginated + tests (#165)
vzart Jun 3, 2023
854304d
Feat/update document (#169)
kaitoz11 Jun 3, 2023
d8601bf
fix: added room checking for updating locker (#175)
StarryFolf Jun 3, 2023
89d5e9f
Fix/logic error in update (#178)
ChienNQuang Jun 3, 2023
11a850e
idek what to write here (#179)
ChienNQuang Jun 4, 2023
ac5993a
huhu (#177)
ChienNQuang Jun 4, 2023
34f537f
now can request a borrow even when a previous request of a user is ca…
ChienNQuang Jun 4, 2023
79121bd
Refactor/include fix (#180)
vzart Jun 4, 2023
055c47a
fix: pagination working wrong (#184)
ChienNQuang Jun 4, 2023
8eb386d
Create versioning.yml (#185)
kaitoz11 Jun 4, 2023
4d735aa
Update versioning.yml
kaitoz11 Jun 4, 2023
402c1d7
test: create borrow request in test (#192)
vzart Jun 6, 2023
3b43bf1
test: add integration tests (#209)
StarryFolf Jun 7, 2023
6f373c9
test: add integration tests for approve borrow request (#204)
StarryFolf Jun 7, 2023
4d47762
test: add integration tests for borrow document (#208)
StarryFolf Jun 7, 2023
f88b114
Add/schema (#202)
ChienNQuang Jun 7, 2023
14d3b4a
Feat/reset password (#215)
ChienNQuang Jun 8, 2023
160cdbd
refactor: add salt (#224)
kaitoz11 Jun 10, 2023
295d2b9
fix: seed some more data and fix swagger not loading
ChienNQuang Jun 12, 2023
b15d821
Update/borrow (#261)
ChienNQuang Jun 21, 2023
6dd5191
refactor: seperate cors rules for environments (#226)
kaitoz11 Jun 22, 2023
87c42a8
fix: src/Application/Application.csproj to reduce vulnerabilities (#260)
kaitoz11 Jun 22, 2023
8072560
feat: implement add user group. (#220)
StarryFolf Jun 22, 2023
0a48269
feat: implement update user group (#223)
StarryFolf Jun 22, 2023
6f980e1
feat: implement delete user group (#222)
StarryFolf Jun 22, 2023
e7031a6
feat: implement get user group (#225)
StarryFolf Jun 23, 2023
9baa635
add: seed staff data (#262)
vzart Jun 25, 2023
438d6cb
remove role constraint for getting document types (#279)
StarryFolf Jun 26, 2023
9ffe74f
fix: assign document (#281)
ChienNQuang Jun 26, 2023
a7676ef
Fix: assign staff + get document by id (#282)
vzart Jun 26, 2023
1b5ea90
update: get all rooms now has availability (#280)
ChienNQuang Jun 27, 2023
da653a2
Fix/import request (#288)
kaitoz11 Jun 27, 2023
3853ebd
fix(ImportDocument): add isPrivate to controller (#289)
kaitoz11 Jun 28, 2023
79dda82
Refactor/logging (#296)
vzart Jun 28, 2023
bcd9246
delete: everything of user group (#308)
ChienNQuang Jun 30, 2023
8886478
implement uploading digital files (#297)
StarryFolf Jul 1, 2023
5fe7e6a
update: document entity now has a file entity instead of entry
ChienNQuang Jul 1, 2023
960a734
add: download document endpoint
ChienNQuang Jul 1, 2023
03f664a
entrydto to file id (#317)
ChienNQuang Jul 2, 2023
bdb4d69
fix: fix condition for checking base directory (#318)
StarryFolf Jul 2, 2023
68ee535
add: entry permission (#314)
ChienNQuang Jul 2, 2023
872db5b
refactor: test green now (#298)
vzart Jul 2, 2023
aa795bd
feat: share permission for entries (#336)
kaitoz11 Jul 3, 2023
8105050
feat: set up for shared entries (#339)
kaitoz11 Jul 5, 2023
27bf50c
Feat/get shared entries (#340)
ChienNQuang Jul 6, 2023
a657808
feat/handle lost report (#221)
kaitoz11 Jul 8, 2023
229655a
feat: get entry by id (#327)
vzart Jul 8, 2023
b85d529
feat: get shared entry permission (#341)
kaitoz11 Jul 8, 2023
9dc03b3
feat: get entries by entry path paginated (#331)
vzart Jul 9, 2023
07245b7
implement getting shared users (#347)
StarryFolf Jul 9, 2023
833d816
feat: add size to entry (#315)
kaitoz11 Jul 9, 2023
4bdd25d
fix: made description not required when adding a room. (#277)
StarryFolf Jul 9, 2023
bdb7663
feat: download a shared entry (#345)
ChienNQuang Jul 9, 2023
be2b508
feat: implement deleting entry in bin (#325)
StarryFolf Jul 9, 2023
e3a6c92
update: added role checking when adding user (#278)
StarryFolf Jul 9, 2023
42478b9
Feat : Upload file or create directory on shared entry by entry ID (#…
vzart Jul 9, 2023
6133db1
i am stoopid stoopid (#350)
vzart Jul 9, 2023
ec7fddf
fix: a couple things (#284)
ChienNQuang Jul 9, 2023
7c40374
fix: get rooms by department id (#286)
vzart Jul 9, 2023
1b4cae8
feat: download digital file (#329)
vzart Jul 9, 2023
6ab6092
fix: update logic when an employee get physical resources (#309)
kaitoz11 Jul 9, 2023
dd57e7f
feat: update entry (#332)
vzart Jul 9, 2023
6f3bb62
hotfix: cuu-dev (#351)
vzart Jul 10, 2023
7e0b86e
update: a couple things (#287)
ChienNQuang Jul 10, 2023
e190c72
implement getting shared entry by id (#349)
StarryFolf Jul 10, 2023
c98c00e
fix: add IsAvailable to update (#353)
vzart Jul 10, 2023
179b350
feat: implement restoring entry (#322)
StarryFolf Jul 10, 2023
9753c97
hotfix: bug in role auth (#354)
kaitoz11 Jul 10, 2023
40686a4
refactor: wrap get all departments with items (#355)
vzart Jul 10, 2023
469fb95
fix: mismapping import request entity with dto (#352)
kaitoz11 Jul 10, 2023
99e4d84
feat: implement moving entry to trash bin (#320)
StarryFolf Jul 10, 2023
f7a2391
fix: filter issued status for get all documents for employee and get …
vzart Jul 10, 2023
aea7adb
hotfix: improper import request status in checkin (#357)
kaitoz11 Jul 10, 2023
d369811
refactor: merge digital and entries packages to 1 packages named entr…
vzart Jul 10, 2023
0a98e79
update: users first times login with default password now are returne…
ChienNQuang Jul 11, 2023
f096f37
update: merge background services into one class (#311)
ChienNQuang Jul 11, 2023
f2796f1
feat: add logs to entries (#362)
vzart Jul 11, 2023
8b02ec1
Delete/log entities (#364)
ChienNQuang Jul 11, 2023
31e86fc
fix: delete shared download file (#367)
vzart Jul 11, 2023
ed20357
fix: NotAllowedException to UnauthorizedAccessException (#368)
vzart Jul 11, 2023
cb21d98
fix: regex validation and change command name. (#366)
StarryFolf Jul 11, 2023
9d161de
fix regex (#372)
StarryFolf Jul 11, 2023
a2934f2
Update/remove entry operations (#371)
ChienNQuang Jul 11, 2023
b5a163a
feat/get bin entries and get bin entry by id (#369)
StarryFolf Jul 11, 2023
3ce3cf8
include file (#374)
ChienNQuang Jul 11, 2023
a70a435
fix (#375)
StarryFolf Jul 11, 2023
18086ea
fix (#377)
ChienNQuang Jul 11, 2023
cacafa5
update entry now update its child too (#378)
ChienNQuang Jul 11, 2023
e2c1a18
update: create shared entries now have permission checked (#376)
ChienNQuang Jul 11, 2023
4da1da0
fix: log entries (#373)
vzart Jul 11, 2023
95b2147
refactor: add entries api documentation (#365)
vzart Jul 11, 2023
5cbe1a1
abc
ChienNQuang Jul 11, 2023
5794e93
xxx
ChienNQuang Jul 11, 2023
866750b
fix
ChienNQuang Jul 11, 2023
88b62cc
sth
ChienNQuang Jul 12, 2023
b60f7cb
refactor logic (#379)
StarryFolf Jul 12, 2023
d60b1f0
fix: admin can see borrow request by id (#380)
vzart Jul 12, 2023
b28e215
fix
ChienNQuang Jul 12, 2023
766dafd
fix: get all users include department (#381)
vzart Jul 12, 2023
f2bf83b
haha
ChienNQuang Jul 12, 2023
eefc997
Merge remote-tracking branch 'origin/dev' into dev
ChienNQuang Jul 12, 2023
ec4388f
I forgot to ship this
ChienNQuang Jul 12, 2023
90e5a08
seed
ChienNQuang Jul 12, 2023
ecf6a5f
x
ChienNQuang Jul 12, 2023
eeae760
x
ChienNQuang Jul 13, 2023
2cacc0a
x
ChienNQuang Jul 13, 2023
28c3e57
Finale/khoa last touch (#382)
vzart Jul 27, 2023
dda247f
add: overdue worker service (#385)
vzart Jul 27, 2023
8a08113
fix: document importer can borrow his/her documents now (#384)
ChienNQuang Jul 27, 2023
03e3e43
ehehe (#386)
ChienNQuang Jul 27, 2023
639beb3
Fix/entry (#383)
StarryFolf Jul 27, 2023
41e6a05
feat: get all shared users for a document (#391)
kaitoz11 Jul 29, 2023
468e8d2
only check extension for files (#388)
ChienNQuang Jul 29, 2023
66ccf12
feat: users tracking (#392)
ChienNQuang Jul 29, 2023
72f287f
Feat/online tracking (#394)
ChienNQuang Jul 30, 2023
1cf9b1f
Update/mail (#390)
ChienNQuang Jul 30, 2023
d84862a
Feat/dashboard (#395)
ChienNQuang Jul 30, 2023
c9f4e7e
feat: found a lost document (#389)
kaitoz11 Jul 30, 2023
b2e7c99
fix: include issuer (#396)
vzart Jul 30, 2023
514750f
update: mail and log
ChienNQuang Jul 30, 2023
048a2af
fix: backgrond workers
ChienNQuang Jul 30, 2023
0ae767c
update: seed users have default password
ChienNQuang Jul 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
74 changes: 74 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "dev", main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "dev" ]

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
21 changes: 21 additions & 0 deletions .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Bump version
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CMD ["dotnet", "test", "--logger:trx"]
# Publish stage
FROM build AS publish
WORKDIR /app/src/Api
RUN dotnet publish -c Release -o /app/publish
RUN dotnet publish -c Release --no-restore -o /app/publish

# Final stage
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal AS runtime
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ services:
ports:
- '8888:80'
environment:
- ASPNETCORE_ENVIRONMENT=Development
- PROFILE_DatabaseSettings__ConnectionString=Server=database;Port=5432;Database=mytestdb;User ID=profiletester;Password=supasupasecured;
- ASPNETCORE_ENVIRONMENT=Testing
- PROFILE_DatabaseSettings__ConnectionString=Server=database;Port=5432;Database=mytestdb;User ID=profiletester;Password=supasupasecured;Include Error Detail=true
depends_on:
database:
condition: service_started
Expand Down
16 changes: 15 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- PROFILE_DatabaseSettings__ConnectionString=Server=database;Port=5432;Database=mydb;User ID=profiletest;Password=supasecured;
- PROFILE_JweSettings__SigningKeyId=4bd28be8eac5414fb01c5cbe343b50144bd28be8eac5414fb01c5cbe343b50144bd28be8eac5414fb01c5cbe343b50144bd28be8eac5414fb01c5cbe343b50144bd28be8eac5414fb01c5cbe343b5014
- PROFILE_JweSettings__EncryptionKeyId=4bd28be8eac5414fb01c5cbe343b5014
- PROFILE_JweSettings__TokenLifetime=00:20:00
- PROFILE_JweSettings__RefreshTokenLifetimeInDays=3
- PROFILE_MailSettings__ClientUrl=https://send.api.mailtrap.io/api/send
- PROFILE_MailSettings__Token=745f040659edff0ce87b545567da72d2
- PROFILE_MailSettings__SenderName=ProFile
- PROFILE_MailSettings__SenderEmail=profile@ezarp.dev
- PROFILE_MailSettings__TemplateUuid=9d6a8f25-65e9-4819-be7d-106ce077acf1
depends_on:
database:
condition: service_started
Expand All @@ -20,4 +29,9 @@ services:
- POSTGRES_PASSWORD=supasecured
- POSTGRES_DB=mydb
ports:
- '5432:5432'
- '5432:5432'
volumes:
- pg_data:/var/lib/postgresql/data

volumes:
pg_data:
3 changes: 3 additions & 0 deletions src/Api/Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -13,6 +14,8 @@
</PackageReference>
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Expressions" Version="3.4.1" />
<PackageReference Include="Serilog.Sinks.PostgreSQL.Alternative" Version="3.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions src/Api/Common/CORSPolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Api.Common;

public static class CORSPolicy
{
public static string Development = "devEnvironment";
public static string Production = "prodEnvironment";
}
38 changes: 34 additions & 4 deletions src/Api/ConfigureServices.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
using System.Reflection;
using Api.Common;
using Api.Middlewares;
using Api.Policies;
using Api.Services;
using Application.Common.Interfaces;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.OpenApi.Models;

namespace Api;

public static class ConfigureServices
{
public static IServiceCollection AddApiServices(this IServiceCollection services)
public static IServiceCollection AddApiServices(this IServiceCollection services, IConfiguration configuration)
{
// TODO: Move this away in the future
var frontendBaseUrl = configuration.GetValue<string>("BASE_FRONTEND_URL") ?? "http://localhost";

// Register services
services.AddServices();
services.AddHostedService<BackgroundWorkers>();

services.AddControllers(opt =>
opt.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
Expand All @@ -18,19 +27,39 @@ public static IServiceCollection AddApiServices(this IServiceCollection services

services.AddCors(options =>
{
options.AddPolicy("AllowAllOrigins", builder =>
options.AddPolicy(CORSPolicy.Development, builder =>
{
builder.SetIsOriginAllowed(_ => true);
builder.AllowAnyHeader();
builder.AllowAnyMethod();
builder.AllowCredentials();
});

options.AddPolicy(CORSPolicy.Production, builder =>
{
builder.AllowAnyOrigin();
builder.WithOrigins(frontendBaseUrl);
builder.AllowAnyHeader();
builder.AllowAnyMethod();
builder.AllowCredentials();
});
});

services.AddHttpContextAccessor();

// For swagger
services.AddEndpointsApiExplorer();
services.AddSwaggerGen();
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "ProFile API",
Description = "An ASP.NET Core Web API for managing documents",
});

var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});

return services;
}
Expand All @@ -39,6 +68,7 @@ private static IServiceCollection AddServices(this IServiceCollection services)
{
// In order for ExceptionMiddleware to work
services.AddScoped<ExceptionMiddleware>();
services.AddScoped<ICurrentUserService, CurrentUserService>();

return services;
}
Expand Down
Loading