Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop' into feat/local-web-app
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/pnpm-lock.yaml
#	frontend/viewer/package.json
  • Loading branch information
hahn-kev committed May 22, 2024
2 parents b6fc351 + ea236cd commit b862519
Show file tree
Hide file tree
Showing 27 changed files with 1,599 additions and 1,831 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ HASURA_GRAPHQL_ADMIN_SECRET=c67eeb626bee405d883b482046934860
# Get test key at https://ui.honeycomb.io/sil-language-forge/environments/test/api_keys
HONEYCOMB_API_KEY=__REPLACE__
OTEL_RESOURCE_ATTRIBUTES=service.version=0.0.1,deployment.environment=dev
OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_DISABLE_URL_QUERY_REDACTION=true

SMTP_USER=maildev
SMTP_PASSWORD=maildev
1 change: 1 addition & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tasks:
- echo "#OTEL_SDK_DISABLED=true" >> deployment/local-dev/local.env
- echo "GOOGLE_OAUTH_CLIENT_ID=__REPLACE__.apps.googleusercontent.com" >> deployment/local-dev/local.env
- echo "GOOGLE_OAUTH_CLIENT_SECRET=__REPLACE__" >> deployment/local-dev/local.env
- kubectl --context=docker-desktop apply -f deployment/setup/namespace.yaml
setup-win:
platforms: [ windows ]
cmds:
Expand Down
32 changes: 20 additions & 12 deletions backend/LexBoxApi/GraphQL/ProjectMutations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,25 @@ await dbContext.ProjectUsers.Where(pu => pu.ProjectId == input.ProjectId && pu.U
return dbContext.Projects.Where(p => p.Id == input.ProjectId);
}

[Error<NotFoundException>]
[Error<DbError>]
[AdminRequired]
[UseMutationConvention]
[UseProjection]
public async Task<DraftProject> DeleteDraftProject(
Guid draftProjectId,
LexBoxDbContext dbContext)
{
var deletedDraft = await dbContext.DraftProjects.FindAsync(draftProjectId);
if (deletedDraft == null)
{
throw NotFoundException.ForType<DraftProject>();
}
// Draft projects are deleted immediately, not soft-deleted
dbContext.DraftProjects.Remove(deletedDraft);
await dbContext.SaveChangesAsync();
return deletedDraft;
}

[Error<NotFoundException>]
[Error<DbError>]
Expand All @@ -356,18 +375,7 @@ public async Task<IQueryable<Project>> SoftDeleteProject(
var project = await dbContext.Projects.Include(p => p.Users).FirstOrDefaultAsync(p => p.Id == projectId);
if (project is null)
{
// Draft projects, if any, are deleted immediately, not soft-deleted
var deletedDraftCount = await dbContext.DraftProjects.Where(dp => dp.Id == projectId).ExecuteDeleteAsync();
if (deletedDraftCount == 0)
{
// No draft project either, so return standard project not found error
throw NotFoundException.ForType<Project>();
}
else
{
// Return an empty project list to indicate success
return dbContext.Projects.Where(p => p.Id == projectId);
}
throw NotFoundException.ForType<Project>();
}
if (project.DeletedDate is not null) throw new InvalidOperationException("Project already deleted");

Expand Down
14 changes: 7 additions & 7 deletions backend/LexBoxApi/LexBoxApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.0" />
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.3" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.8" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Quartz" Version="1.0.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.8.0" />
<PackageReference Include="Quartz.AspNetCore" Version="3.8.0" />
<PackageReference Include="Quartz.Serialization.Json" Version="3.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
Expand Down
4 changes: 2 additions & 2 deletions backend/LexBoxApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"Microsoft.AspNetCore": "Information",
"Microsoft.AspNetCore.HttpOverrides.ForwardedHeadersMiddleware": "Debug",
"Microsoft.EntityFrameworkCore": "Information",
"MongoDB.Command": "Debug",
"MongoDB.Command": "Debug"
}
},
"ForwardedHeadersOptions": {
Expand Down Expand Up @@ -66,6 +66,6 @@
"Endpoint": "http://localhost:4317"
},
"Email": {
"CreateProjectEmailDestination": "admin@languagedepot.org"
"CreateProjectEmailDestination": "[email protected].org"
}
}
4 changes: 2 additions & 2 deletions backend/LexData/LexData.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0" />
<PackageReference Include="Npgsql" Version="8.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions backend/SyncReverseProxy/SyncReverseProxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.0" />
<PackageReference Include="Yarp.ReverseProxy" Version="2.1.0" />

<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
<PackageReference Include="Yarp.Telemetry.Consumption" Version="2.1.0" />

</ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions backend/Testing/Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

<IsPackable>false</IsPackable>
<Mercurial4ChorusDestDir>$(MSBuildProjectDirectory)</Mercurial4ChorusDestDir>
<!-- To switch Mercurial versions, do dotnet build /p:MercurialVersion=6 followed by dotnet test -->
<!-- Note that if you run dotnet test /p:MercurialVersion=6 it will not work as expected; you must run dotnet build first in order to switch Mercurial versions -->
<MercurialVersion Condition=" '$(MercurialVersion)' == '' ">3</MercurialVersion>
<!-- To switch Mercurial versions, do dotnet build /p:MercurialVersion=3 followed by dotnet test -->
<!-- Note that if you run dotnet test /p:MercurialVersion=3 it will not work as expected; you must run dotnet build first in order to switch Mercurial versions -->
<MercurialVersion Condition=" '$(MercurialVersion)' == '' ">6</MercurialVersion>
</PropertyGroup>

<Choose>
<When Condition=" '$(MercurialVersion)' == '6' ">
<ItemGroup>
<PackageReference Include="SIL.Chorus.LibChorus" Version="6.0.0-beta0045" />
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.5.1.29" />
<PackageReference Include="SIL.Chorus.LibChorus" Version="6.0.0-beta0046" />
<PackageReference Include="SIL.Chorus.Mercurial" Version="6.*" />
</ItemGroup>
</When>
<Otherwise>
Expand Down
1 change: 1 addition & 0 deletions deployment/base/hg-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ spec:
securityContext:
runAsUser: 33
runAsGroup: 33 # www-data
runAsNonRoot: true
image: busybox:1.36.1
command:
- 'sh'
Expand Down
2 changes: 2 additions & 0 deletions deployment/base/lexbox-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ spec:
fieldPath: spec.nodeName
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.node.name=$(K8S_NODE_NAME)
- name: OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_DISABLE_URL_QUERY_REDACTION
value: 'true'
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
Expand Down
1 change: 0 additions & 1 deletion deployment/develop/lexbox-deployment.patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ spec:
- name: Email__SmtpPort
value: '587'
- name: Email__From
# TODO: need to parameterize this
value: "Language Depot (Develop) <[email protected]>"
- name: Email__BaseUrl
value: "https://develop.lexbox.org"
1 change: 1 addition & 0 deletions deployment/init-repos/hg-deployment-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
securityContext:
runAsUser: 33
runAsGroup: 33 # www-data
runAsNonRoot: true
image: busybox:1.36.1
command:
- 'sh'
Expand Down
42 changes: 17 additions & 25 deletions deployment/local-dev/ingress-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
name: ingress-nginx
---
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
Expand All @@ -17,7 +9,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx
namespace: ingress-nginx
namespace: languagedepot
---
apiVersion: v1
kind: ServiceAccount
Expand All @@ -29,7 +21,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-admission
namespace: ingress-nginx
namespace: languagedepot
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand All @@ -41,7 +33,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx
namespace: ingress-nginx
namespace: languagedepot
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -131,7 +123,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-admission
namespace: ingress-nginx
namespace: languagedepot
rules:
- apiGroups:
- ""
Expand Down Expand Up @@ -251,15 +243,15 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx
namespace: ingress-nginx
namespace: languagedepot
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ingress-nginx
subjects:
- kind: ServiceAccount
name: ingress-nginx
namespace: ingress-nginx
namespace: languagedepot
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand All @@ -271,15 +263,15 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-admission
namespace: ingress-nginx
namespace: languagedepot
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ingress-nginx-admission
subjects:
- kind: ServiceAccount
name: ingress-nginx-admission
namespace: ingress-nginx
namespace: languagedepot
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -297,7 +289,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: ingress-nginx
namespace: ingress-nginx
namespace: languagedepot
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -316,7 +308,7 @@ roleRef:
subjects:
- kind: ServiceAccount
name: ingress-nginx-admission
namespace: ingress-nginx
namespace: languagedepot
---
apiVersion: v1
data:
Expand All @@ -334,7 +326,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-controller
namespace: ingress-nginx
namespace: languagedepot
---
apiVersion: v1
kind: Service
Expand All @@ -346,7 +338,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-controller
namespace: ingress-nginx
namespace: languagedepot
spec:
externalTrafficPolicy: Local
ipFamilies:
Expand Down Expand Up @@ -379,7 +371,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-controller-admission
namespace: ingress-nginx
namespace: languagedepot
spec:
ports:
- appProtocol: https
Expand All @@ -402,7 +394,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-controller
namespace: ingress-nginx
namespace: languagedepot
spec:
minReadySeconds: 0
revisionHistoryLimit: 10
Expand Down Expand Up @@ -516,7 +508,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-admission-create
namespace: ingress-nginx
namespace: languagedepot
spec:
template:
metadata:
Expand Down Expand Up @@ -563,7 +555,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.8.0
name: ingress-nginx-admission-patch
namespace: ingress-nginx
namespace: languagedepot
spec:
template:
metadata:
Expand Down Expand Up @@ -631,7 +623,7 @@ webhooks:
clientConfig:
service:
name: ingress-nginx-controller-admission
namespace: ingress-nginx
namespace: languagedepot
path: /networking/v1/ingresses
failurePolicy: Fail
matchPolicy: Equivalent
Expand Down
3 changes: 2 additions & 1 deletion deployment/production/lexbox-deployment.patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ spec:
- name: Email__SmtpPort
value: '587'
- name: Email__From
# TODO: need to parameterize this
value: "Language Depot <[email protected]>"
- name: Email__CreateProjectEmailDestination
value: "[email protected]"
- name: Email__BaseUrl
value: "https://languagedepot.org"
File renamed without changes.
1 change: 0 additions & 1 deletion deployment/staging/lexbox-deployment.patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ spec:
- name: Email__SmtpPort
value: '587'
- name: Email__From
# TODO: need to parameterize this
value: "Language Depot (Staging) <[email protected]>"
- name: Email__BaseUrl
value: "https://staging.languagedepot.org"
Loading

0 comments on commit b862519

Please sign in to comment.