??
This commit is contained in:
726
.gitignore
vendored
726
.gitignore
vendored
@@ -1,364 +1,364 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
##
|
##
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
|
||||||
WebAPI/.local-chromium
|
WebAPI/.local-chromium
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.rsuser
|
*.rsuser
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
*.sln.docstates
|
*.sln.docstates
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
||||||
# Mono auto generated files
|
# Mono auto generated files
|
||||||
mono_crash.*
|
mono_crash.*
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
[Rr]elease/
|
[Rr]elease/
|
||||||
[Rr]eleases/
|
[Rr]eleases/
|
||||||
x64/
|
x64/
|
||||||
x86/
|
x86/
|
||||||
[Ww][Ii][Nn]32/
|
[Ww][Ii][Nn]32/
|
||||||
[Aa][Rr][Mm]/
|
[Aa][Rr][Mm]/
|
||||||
[Aa][Rr][Mm]64/
|
[Aa][Rr][Mm]64/
|
||||||
bld/
|
bld/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
[Ll]ogs/
|
[Ll]ogs/
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
#wwwroot/
|
#wwwroot/
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
# Visual Studio 2017 auto generated files
|
||||||
Generated\ Files/
|
Generated\ Files/
|
||||||
|
|
||||||
# MSTest test Results
|
# MSTest test Results
|
||||||
[Tt]est[Rr]esult*/
|
[Tt]est[Rr]esult*/
|
||||||
[Bb]uild[Ll]og.*
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
# NUnit
|
# NUnit
|
||||||
*.VisualState.xml
|
*.VisualState.xml
|
||||||
TestResult.xml
|
TestResult.xml
|
||||||
nunit-*.xml
|
nunit-*.xml
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
# Build Results of an ATL Project
|
||||||
[Dd]ebugPS/
|
[Dd]ebugPS/
|
||||||
[Rr]eleasePS/
|
[Rr]eleasePS/
|
||||||
dlldata.c
|
dlldata.c
|
||||||
|
|
||||||
# Benchmark Results
|
# Benchmark Results
|
||||||
BenchmarkDotNet.Artifacts/
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
# .NET Core
|
# .NET Core
|
||||||
project.lock.json
|
project.lock.json
|
||||||
project.fragment.lock.json
|
project.fragment.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
|
|
||||||
# ASP.NET Scaffolding
|
# ASP.NET Scaffolding
|
||||||
ScaffoldingReadMe.txt
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
# StyleCop
|
# StyleCop
|
||||||
StyleCopReport.xml
|
StyleCopReport.xml
|
||||||
|
|
||||||
# Files built by Visual Studio
|
# Files built by Visual Studio
|
||||||
*_i.c
|
*_i.c
|
||||||
*_p.c
|
*_p.c
|
||||||
*_h.h
|
*_h.h
|
||||||
*.ilk
|
*.ilk
|
||||||
*.meta
|
*.meta
|
||||||
*.obj
|
*.obj
|
||||||
*.iobj
|
*.iobj
|
||||||
*.pch
|
*.pch
|
||||||
*.pdb
|
*.pdb
|
||||||
*.ipdb
|
*.ipdb
|
||||||
*.pgc
|
*.pgc
|
||||||
*.pgd
|
*.pgd
|
||||||
*.rsp
|
*.rsp
|
||||||
*.sbr
|
*.sbr
|
||||||
*.tlb
|
*.tlb
|
||||||
*.tli
|
*.tli
|
||||||
*.tlh
|
*.tlh
|
||||||
*.tmp
|
*.tmp
|
||||||
*.tmp_proj
|
*.tmp_proj
|
||||||
*_wpftmp.csproj
|
*_wpftmp.csproj
|
||||||
*.log
|
*.log
|
||||||
*.vspscc
|
*.vspscc
|
||||||
*.vssscc
|
*.vssscc
|
||||||
.builds
|
.builds
|
||||||
*.pidb
|
*.pidb
|
||||||
*.svclog
|
*.svclog
|
||||||
*.scc
|
*.scc
|
||||||
|
|
||||||
# Chutzpah Test files
|
# Chutzpah Test files
|
||||||
_Chutzpah*
|
_Chutzpah*
|
||||||
|
|
||||||
# Visual C++ cache files
|
# Visual C++ cache files
|
||||||
ipch/
|
ipch/
|
||||||
*.aps
|
*.aps
|
||||||
*.ncb
|
*.ncb
|
||||||
*.opendb
|
*.opendb
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.sdf
|
*.sdf
|
||||||
*.cachefile
|
*.cachefile
|
||||||
*.VC.db
|
*.VC.db
|
||||||
*.VC.VC.opendb
|
*.VC.VC.opendb
|
||||||
|
|
||||||
# Visual Studio profiler
|
# Visual Studio profiler
|
||||||
*.psess
|
*.psess
|
||||||
*.vsp
|
*.vsp
|
||||||
*.vspx
|
*.vspx
|
||||||
*.sap
|
*.sap
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
# Visual Studio Trace Files
|
||||||
*.e2e
|
*.e2e
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
# TFS 2012 Local Workspace
|
||||||
$tf/
|
$tf/
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
# Guidance Automation Toolkit
|
||||||
*.gpState
|
*.gpState
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
# ReSharper is a .NET coding add-in
|
||||||
_ReSharper*/
|
_ReSharper*/
|
||||||
*.[Rr]e[Ss]harper
|
*.[Rr]e[Ss]harper
|
||||||
*.DotSettings.user
|
*.DotSettings.user
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
# TeamCity is a build add-in
|
||||||
_TeamCity*
|
_TeamCity*
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
# DotCover is a Code Coverage Tool
|
||||||
*.dotCover
|
*.dotCover
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
# AxoCover is a Code Coverage Tool
|
||||||
.axoCover/*
|
.axoCover/*
|
||||||
!.axoCover/settings.json
|
!.axoCover/settings.json
|
||||||
|
|
||||||
# Coverlet is a free, cross platform Code Coverage Tool
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
coverage*.json
|
coverage*.json
|
||||||
coverage*.xml
|
coverage*.xml
|
||||||
coverage*.info
|
coverage*.info
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
# Visual Studio code coverage results
|
||||||
*.coverage
|
*.coverage
|
||||||
*.coveragexml
|
*.coveragexml
|
||||||
|
|
||||||
# NCrunch
|
# NCrunch
|
||||||
_NCrunch_*
|
_NCrunch_*
|
||||||
.*crunch*.local.xml
|
.*crunch*.local.xml
|
||||||
nCrunchTemp_*
|
nCrunchTemp_*
|
||||||
|
|
||||||
# MightyMoose
|
# MightyMoose
|
||||||
*.mm.*
|
*.mm.*
|
||||||
AutoTest.Net/
|
AutoTest.Net/
|
||||||
|
|
||||||
# Web workbench (sass)
|
# Web workbench (sass)
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
|
|
||||||
# Installshield output folder
|
# Installshield output folder
|
||||||
[Ee]xpress/
|
[Ee]xpress/
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
# DocProject is a documentation generator add-in
|
||||||
DocProject/buildhelp/
|
DocProject/buildhelp/
|
||||||
DocProject/Help/*.HxT
|
DocProject/Help/*.HxT
|
||||||
DocProject/Help/*.HxC
|
DocProject/Help/*.HxC
|
||||||
DocProject/Help/*.hhc
|
DocProject/Help/*.hhc
|
||||||
DocProject/Help/*.hhk
|
DocProject/Help/*.hhk
|
||||||
DocProject/Help/*.hhp
|
DocProject/Help/*.hhp
|
||||||
DocProject/Help/Html2
|
DocProject/Help/Html2
|
||||||
DocProject/Help/html
|
DocProject/Help/html
|
||||||
|
|
||||||
# Click-Once directory
|
# Click-Once directory
|
||||||
publish/
|
publish/
|
||||||
|
|
||||||
# Publish Web Output
|
# Publish Web Output
|
||||||
*.[Pp]ublish.xml
|
*.[Pp]ublish.xml
|
||||||
*.azurePubxml
|
*.azurePubxml
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
*.pubxml
|
*.pubxml
|
||||||
*.publishproj
|
*.publishproj
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
# in these scripts will be unencrypted
|
# in these scripts will be unencrypted
|
||||||
PublishScripts/
|
PublishScripts/
|
||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
*.nupkg
|
*.nupkg
|
||||||
# NuGet Symbol Packages
|
# NuGet Symbol Packages
|
||||||
*.snupkg
|
*.snupkg
|
||||||
# The packages folder can be ignored because of Package Restore
|
# The packages folder can be ignored because of Package Restore
|
||||||
**/[Pp]ackages/*
|
**/[Pp]ackages/*
|
||||||
# except build/, which is used as an MSBuild target.
|
# except build/, which is used as an MSBuild target.
|
||||||
!**/[Pp]ackages/build/
|
!**/[Pp]ackages/build/
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
#!**/[Pp]ackages/repositories.config
|
#!**/[Pp]ackages/repositories.config
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
*.nuget.props
|
*.nuget.props
|
||||||
*.nuget.targets
|
*.nuget.targets
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
# Microsoft Azure Build Output
|
||||||
csx/
|
csx/
|
||||||
*.build.csdef
|
*.build.csdef
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
# Microsoft Azure Emulator
|
||||||
ecf/
|
ecf/
|
||||||
rcf/
|
rcf/
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
# Windows Store app package directories and files
|
||||||
AppPackages/
|
AppPackages/
|
||||||
BundleArtifacts/
|
BundleArtifacts/
|
||||||
Package.StoreAssociation.xml
|
Package.StoreAssociation.xml
|
||||||
_pkginfo.txt
|
_pkginfo.txt
|
||||||
*.appx
|
*.appx
|
||||||
*.appxbundle
|
*.appxbundle
|
||||||
*.appxupload
|
*.appxupload
|
||||||
|
|
||||||
# Visual Studio cache files
|
# Visual Studio cache files
|
||||||
# files ending in .cache can be ignored
|
# files ending in .cache can be ignored
|
||||||
*.[Cc]ache
|
*.[Cc]ache
|
||||||
# but keep track of directories ending in .cache
|
# but keep track of directories ending in .cache
|
||||||
!?*.[Cc]ache/
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
ClientBin/
|
ClientBin/
|
||||||
~$*
|
~$*
|
||||||
*~
|
*~
|
||||||
*.dbmdl
|
*.dbmdl
|
||||||
*.dbproj.schemaview
|
*.dbproj.schemaview
|
||||||
*.jfm
|
*.jfm
|
||||||
*.pfx
|
*.pfx
|
||||||
*.publishsettings
|
*.publishsettings
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
# Including strong name files can present a security risk
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
#*.snk
|
#*.snk
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
#bower_components/
|
#bower_components/
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
# RIA/Silverlight projects
|
||||||
Generated_Code/
|
Generated_Code/
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
# Backup & report files from converting an old project file
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
# because we have git ;-)
|
# because we have git ;-)
|
||||||
_UpgradeReport_Files/
|
_UpgradeReport_Files/
|
||||||
Backup*/
|
Backup*/
|
||||||
UpgradeLog*.XML
|
UpgradeLog*.XML
|
||||||
UpgradeLog*.htm
|
UpgradeLog*.htm
|
||||||
ServiceFabricBackup/
|
ServiceFabricBackup/
|
||||||
*.rptproj.bak
|
*.rptproj.bak
|
||||||
|
|
||||||
# SQL Server files
|
# SQL Server files
|
||||||
*.mdf
|
*.mdf
|
||||||
*.ldf
|
*.ldf
|
||||||
*.ndf
|
*.ndf
|
||||||
|
|
||||||
# Business Intelligence projects
|
# Business Intelligence projects
|
||||||
*.rdl.data
|
*.rdl.data
|
||||||
*.bim.layout
|
*.bim.layout
|
||||||
*.bim_*.settings
|
*.bim_*.settings
|
||||||
*.rptproj.rsuser
|
*.rptproj.rsuser
|
||||||
*- [Bb]ackup.rdl
|
*- [Bb]ackup.rdl
|
||||||
*- [Bb]ackup ([0-9]).rdl
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
# Microsoft Fakes
|
# Microsoft Fakes
|
||||||
FakesAssemblies/
|
FakesAssemblies/
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
# GhostDoc plugin setting file
|
||||||
*.GhostDoc.xml
|
*.GhostDoc.xml
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
# Node.js Tools for Visual Studio
|
||||||
.ntvs_analysis.dat
|
.ntvs_analysis.dat
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
# Visual Studio 6 build log
|
||||||
*.plg
|
*.plg
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
# Visual Studio 6 workspace options file
|
||||||
*.opt
|
*.opt
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
*.vbw
|
*.vbw
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
# Visual Studio LightSwitch build output
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
**/*.Server/GeneratedArtifacts
|
**/*.Server/GeneratedArtifacts
|
||||||
**/*.Server/ModelManifest.xml
|
**/*.Server/ModelManifest.xml
|
||||||
_Pvt_Extensions
|
_Pvt_Extensions
|
||||||
|
|
||||||
# Paket dependency manager
|
# Paket dependency manager
|
||||||
.paket/paket.exe
|
.paket/paket.exe
|
||||||
paket-files/
|
paket-files/
|
||||||
|
|
||||||
# FAKE - F# Make
|
# FAKE - F# Make
|
||||||
.fake/
|
.fake/
|
||||||
|
|
||||||
# CodeRush personal settings
|
# CodeRush personal settings
|
||||||
.cr/personal
|
.cr/personal
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
# Python Tools for Visual Studio (PTVS)
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
# Cake - Uncomment if you are using it
|
||||||
# tools/**
|
# tools/**
|
||||||
# !tools/packages.config
|
# !tools/packages.config
|
||||||
|
|
||||||
# Tabs Studio
|
# Tabs Studio
|
||||||
*.tss
|
*.tss
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
# Telerik's JustMock configuration file
|
||||||
*.jmconfig
|
*.jmconfig
|
||||||
|
|
||||||
# BizTalk build output
|
# BizTalk build output
|
||||||
*.btp.cs
|
*.btp.cs
|
||||||
*.btm.cs
|
*.btm.cs
|
||||||
*.odx.cs
|
*.odx.cs
|
||||||
*.xsd.cs
|
*.xsd.cs
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
# OpenCover UI analysis results
|
||||||
OpenCover/
|
OpenCover/
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
# Azure Stream Analytics local run output
|
||||||
ASALocalRun/
|
ASALocalRun/
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
# MSBuild Binary and Structured Log
|
||||||
*.binlog
|
*.binlog
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
# NVidia Nsight GPU debugger configuration file
|
||||||
*.nvuser
|
*.nvuser
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
.mfractor/
|
.mfractor/
|
||||||
|
|
||||||
# Local History for Visual Studio
|
# Local History for Visual Studio
|
||||||
.localhistory/
|
.localhistory/
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
# BeatPulse healthcheck temp database
|
||||||
healthchecksdb
|
healthchecksdb
|
||||||
|
|
||||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
MigrationBackup/
|
MigrationBackup/
|
||||||
|
|
||||||
# Ionide (cross platform F# VS Code tools) working folder
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
.ionide/
|
.ionide/
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
# Fody - auto-generated XML schema
|
||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"folders": [
|
"folders": [
|
||||||
{
|
{
|
||||||
"path": "."
|
"path": "."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
50
DiunaBI.sln
50
DiunaBI.sln
@@ -1,25 +1,25 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.4.33110.190
|
VisualStudioVersion = 17.4.33110.190
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiunaBI-WebAPI", "WebAPI\DiunaBI-WebAPI.csproj", "{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiunaBI-WebAPI", "WebAPI\DiunaBI-WebAPI.csproj", "{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{799D68C2-A4C1-43F8-8C35-1126C0AC32D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {2CFA03A7-56D9-4ADE-9B6A-1A3383A1C104}
|
SolutionGuid = {2CFA03A7-56D9-4ADE-9B6A-1A3383A1C104}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"folders": [
|
"folders": [
|
||||||
{
|
{
|
||||||
"path": ".."
|
"path": ".."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<div class="loading-container" *ngIf="loading">
|
<div class="loading-container" *ngIf="loading">
|
||||||
<img class="loading-img" src="../../assets/loader.gif" />
|
<img class="loading-img" src="../../assets/loader.gif" />
|
||||||
</div>
|
</div>
|
||||||
<div class="logo"></div>
|
<div class="logo"></div>
|
||||||
<div class="bg">
|
<div class="bg">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<mat-card appearance="outlined" class="form">
|
<mat-card appearance="outlined" class="form">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<div class="" id="google-button"></div>
|
<div class="" id="google-button"></div>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,63 +1,63 @@
|
|||||||
.bg {
|
.bg {
|
||||||
background-image: url("../../../assets/bg.jpg");
|
background-image: url("../../../assets/bg.jpg");
|
||||||
height: 70vh;
|
height: 70vh;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
padding-top: 30vh;
|
padding-top: 30vh;
|
||||||
}
|
}
|
||||||
.container {
|
.container {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
display: block;
|
display: block;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
.form {
|
.form {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.logo {
|
.logo {
|
||||||
background-image: url('../../../assets/logo.png');
|
background-image: url('../../../assets/logo.png');
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
height: 250px;
|
height: 250px;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
mat-form-field {
|
mat-form-field {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.user {
|
.user {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.load {
|
.load {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.loading-container {
|
.loading-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(100, 100, 100, 0.3);
|
background-color: rgba(100, 100, 100, 0.3);
|
||||||
z-index: 1400;
|
z-index: 1400;
|
||||||
}
|
}
|
||||||
.loading-img {
|
.loading-img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
/* for mobile */
|
/* for mobile */
|
||||||
@media screen and (max-width: 700px) {
|
@media screen and (max-width: 700px) {
|
||||||
.container {
|
.container {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
.logo {
|
.logo {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,98 +1,98 @@
|
|||||||
import { Component, NgZone, OnInit } from '@angular/core';
|
import { Component, NgZone, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import jwt_decode from "jwt-decode";
|
import jwt_decode from "jwt-decode";
|
||||||
import { AuthService } from 'src/app/auth/auth.service';
|
import { AuthService } from 'src/app/auth/auth.service';
|
||||||
import { User } from 'src/app/models/user.model';
|
import { User } from 'src/app/models/user.model';
|
||||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login-page',
|
selector: 'app-login-page',
|
||||||
templateUrl: './login-page.component.html',
|
templateUrl: './login-page.component.html',
|
||||||
styleUrls: ['./login-page.component.scss']
|
styleUrls: ['./login-page.component.scss']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class LoginPageComponent implements OnInit {
|
export class LoginPageComponent implements OnInit {
|
||||||
constructor(
|
constructor(
|
||||||
private router$: Router,
|
private router$: Router,
|
||||||
private auth$: AuthService,
|
private auth$: AuthService,
|
||||||
private ngZone$: NgZone,
|
private ngZone$: NgZone,
|
||||||
private notifications$: NotificationsService
|
private notifications$: NotificationsService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.onGoogleLibraryLoad = () => {
|
window.onGoogleLibraryLoad = () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
google.accounts.id.initialize({
|
google.accounts.id.initialize({
|
||||||
client_id: environment.google.clientId,
|
client_id: environment.google.clientId,
|
||||||
callback: this.handleCredentialResponse.bind(this),
|
callback: this.handleCredentialResponse.bind(this),
|
||||||
auto_select: true,
|
auto_select: true,
|
||||||
cancel_on_tap_outside: true
|
cancel_on_tap_outside: true
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
google.accounts.id.renderButton(
|
google.accounts.id.renderButton(
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
document.getElementById("google-button"),
|
document.getElementById("google-button"),
|
||||||
{ theme: "outline", size: "large", width: "100%" }
|
{ theme: "outline", size: "large", width: "100%" }
|
||||||
);
|
);
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
google.accounts.id.prompt();
|
google.accounts.id.prompt();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
async handleCredentialResponse(response: any) {
|
async handleCredentialResponse(response: any) {
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const responsePayload: any = jwt_decode(response.credential);
|
const responsePayload: any = jwt_decode(response.credential);
|
||||||
this.auth$.user = new User({
|
this.auth$.user = new User({
|
||||||
googleCredentials: response.credential,
|
googleCredentials: response.credential,
|
||||||
userName: `${responsePayload.given_name} ${responsePayload.family_name}`,
|
userName: `${responsePayload.given_name} ${responsePayload.family_name}`,
|
||||||
email: responsePayload.email,
|
email: responsePayload.email,
|
||||||
avatar: responsePayload.picture
|
avatar: responsePayload.picture
|
||||||
});
|
});
|
||||||
this.ngZone$.run(() => {
|
this.ngZone$.run(() => {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
});
|
});
|
||||||
this.auth$.googleCredential = response.credential;
|
this.auth$.googleCredential = response.credential;
|
||||||
await this.auth$.getAPIToken();
|
await this.auth$.getAPIToken();
|
||||||
this.ngZone$.run(() => {
|
this.ngZone$.run(() => {
|
||||||
this.router$.navigate(['/app']);
|
this.router$.navigate(['/app']);
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error('handleCredentialResponse', e);
|
console.error('handleCredentialResponse', e);
|
||||||
this.ngZone$.run(() => {
|
this.ngZone$.run(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
if (e.status === 401) {
|
if (e.status === 401) {
|
||||||
this.ngZone$.run(() => {
|
this.ngZone$.run(() => {
|
||||||
this.notifications$.add({
|
this.notifications$.add({
|
||||||
text: "User not exists in DiunaBI database.",
|
text: "User not exists in DiunaBI database.",
|
||||||
btn: "OK",
|
btn: "OK",
|
||||||
duration: 15000
|
duration: 15000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.ngZone$.run(() => {
|
this.ngZone$.run(() => {
|
||||||
this.notifications$.add({
|
this.notifications$.add({
|
||||||
text: "DiunaBI server not responded.",
|
text: "DiunaBI server not responded.",
|
||||||
btn: "OK",
|
btn: "OK",
|
||||||
duration: 15000
|
duration: 15000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
mat-card {
|
mat-card {
|
||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
background-color: rgba(255, 145, 0, 0.4);
|
background-color: rgba(255, 145, 0, 0.4);
|
||||||
}
|
}
|
||||||
.action-button {
|
.action-button {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.text {
|
.text {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
.btn {
|
.btn {
|
||||||
float: right;
|
float: right;
|
||||||
color: red;
|
color: red;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
@@ -1,56 +1,56 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
HttpRequest,
|
HttpRequest,
|
||||||
HttpHandler,
|
HttpHandler,
|
||||||
HttpEvent,
|
HttpEvent,
|
||||||
HttpInterceptor
|
HttpInterceptor
|
||||||
} from '@angular/common/http';
|
} from '@angular/common/http';
|
||||||
import { AuthService } from '../auth/auth.service';
|
import { AuthService } from '../auth/auth.service';
|
||||||
import { EMPTY, Observable } from 'rxjs';
|
import { EMPTY, Observable } from 'rxjs';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { catchError, mergeMap } from 'rxjs/operators';
|
import { catchError, mergeMap } from 'rxjs/operators';
|
||||||
import { NotificationsService } from '../services/notifications.service';
|
import { NotificationsService } from '../services/notifications.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthInterceptor implements HttpInterceptor {
|
export class AuthInterceptor implements HttpInterceptor {
|
||||||
constructor(
|
constructor(
|
||||||
private auth$: AuthService,
|
private auth$: AuthService,
|
||||||
private notifications$: NotificationsService
|
private notifications$: NotificationsService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||||
console.log('Welcome to interceptor:', request.url);
|
console.log('Welcome to interceptor:', request.url);
|
||||||
console.log('IsAuth?', request.url.includes('/auth/apiToken'));
|
console.log('IsAuth?', request.url.includes('/auth/apiToken'));
|
||||||
if (!request.url.includes('/auth/apiToken')) {
|
if (!request.url.includes('/auth/apiToken')) {
|
||||||
console.log(this.auth$.expirationTime.format(), moment.utc().format());
|
console.log(this.auth$.expirationTime.format(), moment.utc().format());
|
||||||
if (this.auth$.expirationTime.isBefore(moment.utc())) {
|
if (this.auth$.expirationTime.isBefore(moment.utc())) {
|
||||||
console.log('Need to refresh token');
|
console.log('Need to refresh token');
|
||||||
return this.auth$.getAPITokenObservable().pipe(
|
return this.auth$.getAPITokenObservable().pipe(
|
||||||
mergeMap(() => {
|
mergeMap(() => {
|
||||||
console.log('New token is ready');
|
console.log('New token is ready');
|
||||||
return next.handle(request.clone({
|
return next.handle(request.clone({
|
||||||
headers: request.headers.set('Authorization', `Bearer ${this.auth$.apiToken}`),
|
headers: request.headers.set('Authorization', `Bearer ${this.auth$.apiToken}`),
|
||||||
}));
|
}));
|
||||||
}),
|
}),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
this.notifications$.add({
|
this.notifications$.add({
|
||||||
text: "User session is expired and unable to restore. Please restart the app.",
|
text: "User session is expired and unable to restore. Please restart the app.",
|
||||||
btn: "Restart",
|
btn: "Restart",
|
||||||
action: () => { window.location.reload(); },
|
action: () => { window.location.reload(); },
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
});
|
});
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log('TOken is fine');
|
console.log('TOken is fine');
|
||||||
return next.handle(request.clone({
|
return next.handle(request.clone({
|
||||||
headers: request.headers.set('Authorization', `Bearer ${this.auth$.apiToken}`),
|
headers: request.headers.set('Authorization', `Bearer ${this.auth$.apiToken}`),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return next.handle(request);
|
return next.handle(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
HttpRequest,
|
HttpRequest,
|
||||||
HttpHandler,
|
HttpHandler,
|
||||||
HttpEvent,
|
HttpEvent,
|
||||||
HttpInterceptor
|
HttpInterceptor
|
||||||
} from '@angular/common/http';
|
} from '@angular/common/http';
|
||||||
import { finalize, Observable } from 'rxjs';
|
import { finalize, Observable } from 'rxjs';
|
||||||
import { DataService } from '../services/data.service';
|
import { DataService } from '../services/data.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class LoaderInterceptor implements HttpInterceptor {
|
export class LoaderInterceptor implements HttpInterceptor {
|
||||||
|
|
||||||
private tasks = 0;
|
private tasks = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private data$: DataService
|
private data$: DataService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||||
this.addTask();
|
this.addTask();
|
||||||
return next.handle(request).pipe(
|
return next.handle(request).pipe(
|
||||||
finalize(() => {
|
finalize(() => {
|
||||||
this.removeTask();
|
this.removeTask();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
addTask() {
|
addTask() {
|
||||||
this.tasks++;
|
this.tasks++;
|
||||||
if (this.tasks === 1) {
|
if (this.tasks === 1) {
|
||||||
this.data$.showLoader.next(true);
|
this.data$.showLoader.next(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTask() {
|
removeTask() {
|
||||||
this.tasks--;
|
this.tasks--;
|
||||||
if (this.tasks === 0) {
|
if (this.tasks === 0) {
|
||||||
this.data$.showLoader.next(false);
|
this.data$.showLoader.next(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,128 +1,128 @@
|
|||||||
.main-container {
|
.main-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
.sidenav-container {
|
.sidenav-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
mat-icon.menu-icon {
|
mat-icon.menu-icon {
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
mat-nav-list.menu-sublist {
|
mat-nav-list.menu-sublist {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
mat-nav-list.menu-sublist > a {
|
mat-nav-list.menu-sublist > a {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
div.footer {
|
div.footer {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
color: gray;
|
color: gray;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
.fill-to-right {
|
.fill-to-right {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
span.topbar-user-name {
|
span.topbar-user-name {
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
h1.topbar-app-name {
|
h1.topbar-app-name {
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
mat-sidenav {
|
mat-sidenav {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
.list-container {
|
.list-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
height: 98%;
|
height: 98%;
|
||||||
}
|
}
|
||||||
.top-list-container {
|
.top-list-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-width: 30vh;
|
min-width: 30vh;
|
||||||
height: 54vh;
|
height: 54vh;
|
||||||
}
|
}
|
||||||
.bottom-list-container {
|
.bottom-list-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 35vh;
|
height: 35vh;
|
||||||
}
|
}
|
||||||
.table {
|
.table {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
.list-header {
|
.list-header {
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
padding: 4px 12px 0;
|
padding: 4px 12px 0;
|
||||||
}
|
}
|
||||||
.mat-mdc-form-field {
|
.mat-mdc-form-field {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
mat-form-field.detail-input {
|
mat-form-field.detail-input {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
mat-form-field.detail-input-full-width {
|
mat-form-field.detail-input-full-width {
|
||||||
width: 96%;
|
width: 96%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
input[disabled] {
|
input[disabled] {
|
||||||
color: black;
|
color: black;
|
||||||
-webkit-text-fill-color: black;
|
-webkit-text-fill-color: black;
|
||||||
opacity: 1; /* required on iOS */
|
opacity: 1; /* required on iOS */
|
||||||
}
|
}
|
||||||
textarea[disabled] {
|
textarea[disabled] {
|
||||||
color: black;
|
color: black;
|
||||||
-webkit-text-fill-color: black;
|
-webkit-text-fill-color: black;
|
||||||
opacity: 1; /* required on iOS */
|
opacity: 1; /* required on iOS */
|
||||||
}
|
}
|
||||||
.loading-container {
|
.loading-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(100, 100, 100, 0.3);
|
background-color: rgba(100, 100, 100, 0.3);
|
||||||
z-index: 1400;
|
z-index: 1400;
|
||||||
}
|
}
|
||||||
.loading-img {
|
.loading-img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
.flip-container {
|
.flip-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(100, 100, 100, 0.95);
|
background-color: rgba(100, 100, 100, 0.95);
|
||||||
z-index: 1500;
|
z-index: 1500;
|
||||||
}
|
}
|
||||||
.flip-msg {
|
.flip-msg {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-top: 45vh;
|
padding-top: 45vh;
|
||||||
color: rgb(205, 206, 177);
|
color: rgb(205, 206, 177);
|
||||||
font-size: larger;
|
font-size: larger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* links */
|
/* links */
|
||||||
a:link,
|
a:link,
|
||||||
a:visited {
|
a:visited {
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
@@ -1,73 +1,73 @@
|
|||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
//import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
//import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
//import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
//import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
//import { MatCheckboxModule } from '@angular/material/checkbox';
|
//import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
//import { MatChipsModule } from '@angular/material/chips';
|
//import { MatChipsModule } from '@angular/material/chips';
|
||||||
//import { MatStepperModule } from '@angular/material/stepper';
|
//import { MatStepperModule } from '@angular/material/stepper';
|
||||||
//import { MatDatepickerModule } from '@angular/material/datepicker';
|
//import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||||
//import { MatDialogModule } from '@angular/material/dialog';
|
//import { MatDialogModule } from '@angular/material/dialog';
|
||||||
//import { MatExpansionModule } from '@angular/material/expansion';
|
//import { MatExpansionModule } from '@angular/material/expansion';
|
||||||
import { MatGridListModule } from '@angular/material/grid-list';
|
import { MatGridListModule } from '@angular/material/grid-list';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { MatListModule } from '@angular/material/list';
|
import { MatListModule } from '@angular/material/list';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||||
//import { MatProgressBarModule } from '@angular/material/progress-bar';
|
//import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||||
//import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
//import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
//import { MatRadioModule } from '@angular/material/radio';
|
//import { MatRadioModule } from '@angular/material/radio';
|
||||||
//import { MatRippleModule } from '@angular/material/core';
|
//import { MatRippleModule } from '@angular/material/core';
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||||
//import { MatSliderModule } from '@angular/material/slider';
|
//import { MatSliderModule } from '@angular/material/slider';
|
||||||
//import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
//import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||||
import { MatSortModule } from '@angular/material/sort';
|
import { MatSortModule } from '@angular/material/sort';
|
||||||
import { MatTableModule } from '@angular/material/table';
|
import { MatTableModule } from '@angular/material/table';
|
||||||
//import { MatTabsModule } from '@angular/material/tabs';
|
//import { MatTabsModule } from '@angular/material/tabs';
|
||||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
//import { MatTooltipModule } from '@angular/material/tooltip';
|
//import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
//import {CdkTableModule} from '@angular/cdk/table';
|
//import {CdkTableModule} from '@angular/cdk/table';
|
||||||
//import {MatBadgeModule} from '@angular/material/badge';
|
//import {MatBadgeModule} from '@angular/material/badge';
|
||||||
import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
|
import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
exports: [
|
exports: [
|
||||||
// CdkTableModule,
|
// CdkTableModule,
|
||||||
// MatAutocompleteModule,
|
// MatAutocompleteModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
// MatButtonToggleModule,
|
// MatButtonToggleModule,
|
||||||
MatCardModule,
|
MatCardModule,
|
||||||
// MatCheckboxModule,
|
// MatCheckboxModule,
|
||||||
// MatChipsModule,
|
// MatChipsModule,
|
||||||
// MatStepperModule,
|
// MatStepperModule,
|
||||||
// MatDatepickerModule,
|
// MatDatepickerModule,
|
||||||
// MatDialogModule,
|
// MatDialogModule,
|
||||||
// MatExpansionModule,
|
// MatExpansionModule,
|
||||||
MatGridListModule,
|
MatGridListModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
MatListModule,
|
MatListModule,
|
||||||
MatMenuModule,
|
MatMenuModule,
|
||||||
MatPaginatorModule,
|
MatPaginatorModule,
|
||||||
// MatProgressBarModule,
|
// MatProgressBarModule,
|
||||||
// MatProgressSpinnerModule,
|
// MatProgressSpinnerModule,
|
||||||
// MatRadioModule,
|
// MatRadioModule,
|
||||||
// MatRippleModule,
|
// MatRippleModule,
|
||||||
MatSelectModule,
|
MatSelectModule,
|
||||||
// MatSidenavModule,
|
// MatSidenavModule,
|
||||||
// MatSliderModule,
|
// MatSliderModule,
|
||||||
// MatSlideToggleModule,
|
// MatSlideToggleModule,
|
||||||
MatSortModule,
|
MatSortModule,
|
||||||
MatTableModule,
|
MatTableModule,
|
||||||
// MatTabsModule,
|
// MatTabsModule,
|
||||||
MatToolbarModule,
|
MatToolbarModule,
|
||||||
// MatTooltipModule,
|
// MatTooltipModule,
|
||||||
MatSidenavModule,
|
MatSidenavModule,
|
||||||
// MatBadgeModule,
|
// MatBadgeModule,
|
||||||
MatBottomSheetModule
|
MatBottomSheetModule
|
||||||
],
|
],
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
export class MaterialModule {}
|
export class MaterialModule {}
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
import { Moment } from 'moment';
|
import { Moment } from 'moment';
|
||||||
|
|
||||||
import { Deserializable } from './deserializable.model';
|
import { Deserializable } from './deserializable.model';
|
||||||
import { Serializable } from './serializable.model';
|
import { Serializable } from './serializable.model';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { User } from './user.model';
|
import { User } from './user.model';
|
||||||
|
|
||||||
export class Base implements Deserializable, Serializable {
|
export class Base implements Deserializable, Serializable {
|
||||||
id?: string;
|
id?: string;
|
||||||
createdAt?: Moment;
|
createdAt?: Moment;
|
||||||
modifiedAt?: Moment;
|
modifiedAt?: Moment;
|
||||||
createdById?: string;
|
createdById?: string;
|
||||||
modifiedById?: string;
|
modifiedById?: string;
|
||||||
createdBy?: User;
|
createdBy?: User;
|
||||||
modifiedBy?: User;
|
modifiedBy?: User;
|
||||||
|
|
||||||
constructor(data: Partial<Base> = {}) {
|
constructor(data: Partial<Base> = {}) {
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
deserialize(input: any): this {
|
deserialize(input: any): this {
|
||||||
if (input.createdAt) { input.createdAt = moment(input.createdAt).utc(true); }
|
if (input.createdAt) { input.createdAt = moment(input.createdAt).utc(true); }
|
||||||
if (input.modifiedAt) { input.modifiedAt = moment(input.modifiedAt).utc(true); }
|
if (input.modifiedAt) { input.modifiedAt = moment(input.modifiedAt).utc(true); }
|
||||||
if (input.createdBy) { input.createdBy = new User(input.createdBy); }
|
if (input.createdBy) { input.createdBy = new User(input.createdBy); }
|
||||||
if (input.modifiedBy) { input.modifiedBy = new User(input.modifiedBy); }
|
if (input.modifiedBy) { input.modifiedBy = new User(input.modifiedBy); }
|
||||||
Object.assign(this, input);
|
Object.assign(this, input);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
serialize() : any {
|
serialize() : any {
|
||||||
return Object.assign({}, this);
|
return Object.assign({}, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export interface Deserializable {
|
export interface Deserializable {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
deserialize(input: any): this;
|
deserialize(input: any): this;
|
||||||
}
|
}
|
||||||
@@ -1,124 +1,124 @@
|
|||||||
import { Base } from './base.model';
|
import { Base } from './base.model';
|
||||||
import { UntypedFormBuilder, Validators, UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormBuilder, Validators, UntypedFormGroup } from '@angular/forms';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { map } from 'rxjs';
|
import { map } from 'rxjs';
|
||||||
import { Record } from 'src/app/models/record.model';
|
import { Record } from 'src/app/models/record.model';
|
||||||
|
|
||||||
export class Layer extends Base {
|
export class Layer extends Base {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
number?: Number;
|
number?: Number;
|
||||||
source?: string;
|
source?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
records: Record[] = [];
|
records: Record[] = [];
|
||||||
created?: string;
|
created?: string;
|
||||||
|
|
||||||
constructor(data: Partial<Layer> = {}) {
|
constructor(data: Partial<Layer> = {}) {
|
||||||
super();
|
super();
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
override deserialize(input: any): this {
|
override deserialize(input: any): this {
|
||||||
Object.assign(this, Object.assign(this, super.deserialize(input)));
|
Object.assign(this, Object.assign(this, super.deserialize(input)));
|
||||||
if (this.records) { this.records = this.records.map(x => new Record().deserialize(x)); }
|
if (this.records) { this.records = this.records.map(x => new Record().deserialize(x)); }
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
override serialize() {
|
override serialize() {
|
||||||
this.number = 0; // will be overrided in backend
|
this.number = 0; // will be overrided in backend
|
||||||
return Object.assign({}, this);
|
return Object.assign({}, this);
|
||||||
}
|
}
|
||||||
static getForm(fb: UntypedFormBuilder) {
|
static getForm(fb: UntypedFormBuilder) {
|
||||||
return fb.group({
|
return fb.group({
|
||||||
id: [null],
|
id: [null],
|
||||||
name: ['', Validators.required],
|
name: ['', Validators.required],
|
||||||
source: ['', Validators.required],
|
source: ['', Validators.required],
|
||||||
sheetId: '1G_Hu8DTP-PSPNXTaVYhc_ppnTQi6HWoA4oXSSdUmM9E',
|
sheetId: '1G_Hu8DTP-PSPNXTaVYhc_ppnTQi6HWoA4oXSSdUmM9E',
|
||||||
createdAt: '',
|
createdAt: '',
|
||||||
modifiedAt: '',
|
modifiedAt: '',
|
||||||
createdBy: '',
|
createdBy: '',
|
||||||
modifiedBy: '',
|
modifiedBy: '',
|
||||||
modified: '',
|
modified: '',
|
||||||
created: ''
|
created: ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
fillForm(form: UntypedFormGroup) {
|
fillForm(form: UntypedFormGroup) {
|
||||||
form.patchValue(this);
|
form.patchValue(this);
|
||||||
form.patchValue({
|
form.patchValue({
|
||||||
createdBy: this.createdBy?.userName,
|
createdBy: this.createdBy?.userName,
|
||||||
modifiedBy: this.modifiedBy?.userName
|
modifiedBy: this.modifiedBy?.userName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
loadForm(form: UntypedFormGroup) {
|
loadForm(form: UntypedFormGroup) {
|
||||||
for (const field of Object.keys(form.controls)) {
|
for (const field of Object.keys(form.controls)) {
|
||||||
this[field as keyof Layer] = form.controls[field].value;
|
this[field as keyof Layer] = form.controls[field].value;
|
||||||
}
|
}
|
||||||
this.createdBy = undefined;
|
this.createdBy = undefined;
|
||||||
this.modifiedBy = undefined;
|
this.modifiedBy = undefined;
|
||||||
}
|
}
|
||||||
//API Actions
|
//API Actions
|
||||||
static add(input: Layer, _http: HttpClient): Promise<string> {
|
static add(input: Layer, _http: HttpClient): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
_http.post<string>(`${environment.api.url}/layers`, { ...input.serialize(), }).subscribe({
|
_http.post<string>(`${environment.api.url}/layers`, { ...input.serialize(), }).subscribe({
|
||||||
next: (data) => resolve(data),
|
next: (data) => resolve(data),
|
||||||
error: (e) => reject(e)
|
error: (e) => reject(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
static getList(_http: HttpClient): any {
|
static getList(_http: HttpClient): any {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
_http.get<Layer[]>(`${environment.api.url}/layers`)
|
_http.get<Layer[]>(`${environment.api.url}/layers`)
|
||||||
.pipe(map(data => data.map(x => new Layer().deserialize(x))))
|
.pipe(map(data => data.map(x => new Layer().deserialize(x))))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (data) => resolve(data),
|
next: (data) => resolve(data),
|
||||||
error: (e) => reject(e)
|
error: (e) => reject(e)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static getById(id: string, _http: HttpClient): Promise<Layer> {
|
static getById(id: string, _http: HttpClient): Promise<Layer> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
_http.get<Layer>(`${environment.api.url}/layers/${id}`).pipe(map(x => new Layer().deserialize(x))).subscribe({
|
_http.get<Layer>(`${environment.api.url}/layers/${id}`).pipe(map(x => new Layer().deserialize(x))).subscribe({
|
||||||
next: (data) => resolve(data),
|
next: (data) => resolve(data),
|
||||||
error: (e) => reject(e)
|
error: (e) => reject(e)
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static parseFile(file: File, _http: HttpClient): Promise<Layer[]> {
|
static parseFile(file: File, _http: HttpClient): Promise<Layer[]> {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append(file.name, file);
|
formData.append(file.name, file);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
_http.post<Layer[]>(`${environment.api.url}/layers/parseFile`, formData,
|
_http.post<Layer[]>(`${environment.api.url}/layers/parseFile`, formData,
|
||||||
).pipe(map(data => data.map(x => new Layer().deserialize(x))))
|
).pipe(map(data => data.map(x => new Layer().deserialize(x))))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (data) => {
|
next: (data) => {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
},
|
},
|
||||||
error: (e) => reject(e)
|
error: (e) => reject(e)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
static parseGoogleSheet(sheetId: string, _http: HttpClient): Promise<Layer> {
|
static parseGoogleSheet(sheetId: string, _http: HttpClient): Promise<Layer> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
_http.get<Layer>(`${environment.api.url}/layers/parseGoogleSheet/${sheetId}`,
|
_http.get<Layer>(`${environment.api.url}/layers/parseGoogleSheet/${sheetId}`,
|
||||||
).pipe(map(data => new Layer().deserialize(data)))
|
).pipe(map(data => new Layer().deserialize(data)))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (data) => {
|
next: (data) => {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
},
|
},
|
||||||
error: (e) => reject(e)
|
error: (e) => reject(e)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
static exportToGoogleSheet(id: string, _http: HttpClient): Promise<boolean> {
|
static exportToGoogleSheet(id: string, _http: HttpClient): Promise<boolean> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
_http.get<boolean>(`${environment.api.url}/layers/exportToGoogleSheet/${id}`,
|
_http.get<boolean>(`${environment.api.url}/layers/exportToGoogleSheet/${id}`,
|
||||||
).subscribe({
|
).subscribe({
|
||||||
next: (data) => {
|
next: (data) => {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
},
|
},
|
||||||
error: (e) => reject(e)
|
error: (e) => reject(e)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
import { Base } from './base.model';
|
import { Base } from './base.model';
|
||||||
|
|
||||||
export class Record extends Base {
|
export class Record extends Base {
|
||||||
code?: string;
|
code?: string;
|
||||||
value?: number;
|
value?: number;
|
||||||
desc1?: string;
|
desc1?: string;
|
||||||
desc2?: string;
|
desc2?: string;
|
||||||
desc3?: string;
|
desc3?: string;
|
||||||
desc4?: string;
|
desc4?: string;
|
||||||
desc5?: string;
|
desc5?: string;
|
||||||
|
|
||||||
constructor(data: Partial<Record> = {}) {
|
constructor(data: Partial<Record> = {}) {
|
||||||
super();
|
super();
|
||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
override deserialize(input: any): this {
|
override deserialize(input: any): this {
|
||||||
Object.assign(this, Object.assign(this, super.deserialize(input)));
|
Object.assign(this, Object.assign(this, super.deserialize(input)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export interface Serializable {
|
export interface Serializable {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
serialize(input: this): any;
|
serialize(input: this): any;
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
export class User {
|
export class User {
|
||||||
id!: string;
|
id!: string;
|
||||||
email!: string;
|
email!: string;
|
||||||
userName!: string;
|
userName!: string;
|
||||||
googleCredentials!: string;
|
googleCredentials!: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
constructor(input: any) {
|
constructor(input: any) {
|
||||||
Object.assign(this, input)
|
Object.assign(this, input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { DeviceService } from 'src/app/services/device.service';
|
import { DeviceService } from 'src/app/services/device.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-board',
|
selector: 'app-board',
|
||||||
templateUrl: './board.component.html',
|
templateUrl: './board.component.html',
|
||||||
styleUrls: ['./board.component.scss']
|
styleUrls: ['./board.component.scss']
|
||||||
})
|
})
|
||||||
export class BoardComponent {
|
export class BoardComponent {
|
||||||
constructor(
|
constructor(
|
||||||
public _device: DeviceService
|
public _device: DeviceService
|
||||||
) { }
|
) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
import { BoardComponent } from './board/board.component';
|
import { BoardComponent } from './board/board.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: BoardComponent
|
component: BoardComponent
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class DashboardRoutingModule { }
|
export class DashboardRoutingModule { }
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
import { DashboardRoutingModule } from './dashboard-routing.module';
|
import { DashboardRoutingModule } from './dashboard-routing.module';
|
||||||
import { BoardComponent } from './board/board.component';
|
import { BoardComponent } from './board/board.component';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
BoardComponent
|
BoardComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
DashboardRoutingModule
|
DashboardRoutingModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class DashboardModule { }
|
export class DashboardModule { }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@import "../../../main-view/main-view.component.scss";
|
@import "../../../main-view/main-view.component.scss";
|
||||||
|
|
||||||
.file-input {
|
.file-input {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
import { LayerDetailComponent } from './layer-detail/layer-detail.component';
|
import { LayerDetailComponent } from './layer-detail/layer-detail.component';
|
||||||
import { LayerEditComponent } from './layer-edit/layer-edit.component';
|
import { LayerEditComponent } from './layer-edit/layer-edit.component';
|
||||||
import { LayersListComponent } from './layers-list/layers-list.component';
|
import { LayersListComponent } from './layers-list/layers-list.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', component: LayersListComponent },
|
{ path: '', component: LayersListComponent },
|
||||||
{ path: 'Edit/:id', component: LayerEditComponent },
|
{ path: 'Edit/:id', component: LayerEditComponent },
|
||||||
{ path: 'Detail/:id', component: LayerDetailComponent }
|
{ path: 'Detail/:id', component: LayerDetailComponent }
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class LayersRoutingModule { }
|
export class LayersRoutingModule { }
|
||||||
|
|||||||
@@ -1,88 +1,88 @@
|
|||||||
Function IsDatabaseExists{
|
Function IsDatabaseExists{
|
||||||
param([string]$containerId, [string]$database, [string]$sqlPass)
|
param([string]$containerId, [string]$database, [string]$sqlPass)
|
||||||
$query = "IF EXISTS
|
$query = "IF EXISTS
|
||||||
(SELECT name FROM master.sys.databases WHERE name = N'$database')
|
(SELECT name FROM master.sys.databases WHERE name = N'$database')
|
||||||
PRINT 'yes'
|
PRINT 'yes'
|
||||||
ELSE
|
ELSE
|
||||||
PRINT 'no'"
|
PRINT 'no'"
|
||||||
return (docker exec $containerId /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $sqlPass -Q $query)
|
return (docker exec $containerId /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $sqlPass -Q $query)
|
||||||
# USE master; ALTER DATABASE b-crm-master; SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE b-crm-master;
|
# USE master; ALTER DATABASE b-crm-master; SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE b-crm-master;
|
||||||
}
|
}
|
||||||
Function DropDatabase{
|
Function DropDatabase{
|
||||||
param([string]$containerId, [string]$database, [string]$sqlPass)
|
param([string]$containerId, [string]$database, [string]$sqlPass)
|
||||||
$query = "USE master;
|
$query = "USE master;
|
||||||
ALTER DATABASE [$database]
|
ALTER DATABASE [$database]
|
||||||
SET SINGLE_USER
|
SET SINGLE_USER
|
||||||
WITH ROLLBACK IMMEDIATE;
|
WITH ROLLBACK IMMEDIATE;
|
||||||
GO
|
GO
|
||||||
DROP DATABASE [$database];"
|
DROP DATABASE [$database];"
|
||||||
docker exec $containerId /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $sqlPass -Q $query > $null
|
docker exec $containerId /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $sqlPass -Q $query > $null
|
||||||
return;
|
return;
|
||||||
# /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'v](8Lc|RfG' -Q "USE master; ALTER DATABASE b-crm-master; SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE b-crm-master;"
|
# /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'v](8Lc|RfG' -Q "USE master; ALTER DATABASE b-crm-master; SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE b-crm-master;"
|
||||||
}
|
}
|
||||||
Function AttachDatabase{
|
Function AttachDatabase{
|
||||||
param([string]$containerId, [string]$database, [string]$sqlPass, [string]$mdfName, [string]$ldfName)
|
param([string]$containerId, [string]$database, [string]$sqlPass, [string]$mdfName, [string]$ldfName)
|
||||||
$query = "CREATE DATABASE [$database]
|
$query = "CREATE DATABASE [$database]
|
||||||
ON (FILENAME = N'/var/opt/mssql/data/$mdfName'),
|
ON (FILENAME = N'/var/opt/mssql/data/$mdfName'),
|
||||||
(FILENAME = N'/var/opt/mssql/data/$ldfName') FOR ATTACH;
|
(FILENAME = N'/var/opt/mssql/data/$ldfName') FOR ATTACH;
|
||||||
ALTER DATABASE [$database] SET READ_WRITE;"
|
ALTER DATABASE [$database] SET READ_WRITE;"
|
||||||
docker exec $containerId /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $sqlPass -Q $query
|
docker exec $containerId /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $sqlPass -Q $query
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Function CopyFile{
|
Function CopyFile{
|
||||||
param([string]$containerId, [string]$fileName)
|
param([string]$containerId, [string]$fileName)
|
||||||
docker cp ./Temp/$fileName $containerId"://var/opt/mssql/data/$fileName"
|
docker cp ./Temp/$fileName $containerId"://var/opt/mssql/data/$fileName"
|
||||||
docker exec --user root $containerId chown mssql:root /var/opt/mssql/data/$fileName
|
docker exec --user root $containerId chown mssql:root /var/opt/mssql/data/$fileName
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Split-Path (Get-Location) -Leaf) -ne "DiunaBI") {
|
if ((Split-Path (Get-Location) -Leaf) -ne "DiunaBI") {
|
||||||
Write-Host "Error: Run script from main source directory.";
|
Write-Host "Error: Run script from main source directory.";
|
||||||
Exit;
|
Exit;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$containerId = (docker ps | Select-String "mssql").Line.split(" ")[0]
|
$containerId = (docker ps | Select-String "mssql").Line.split(" ")[0]
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "Error: MSSQL container not exists (or Docker is not running)";
|
Write-Host "Error: MSSQL container not exists (or Docker is not running)";
|
||||||
Exit;
|
Exit;
|
||||||
}
|
}
|
||||||
Write-Host "MSSQL container id: "$containerId;
|
Write-Host "MSSQL container id: "$containerId;
|
||||||
|
|
||||||
$sqlPass = "v](8Lc|RfG";
|
$sqlPass = "v](8Lc|RfG";
|
||||||
# Let's do the job!
|
# Let's do the job!
|
||||||
@("diuna").ForEach({
|
@("diuna").ForEach({
|
||||||
$database = $_;
|
$database = $_;
|
||||||
$ldfName = $database+"_log.ldf";
|
$ldfName = $database+"_log.ldf";
|
||||||
$mdfName = $database+".mdf";
|
$mdfName = $database+".mdf";
|
||||||
|
|
||||||
Write-Host "Restoring database: "$database
|
Write-Host "Restoring database: "$database
|
||||||
# Download mdf/ldf nd check if files are new (donwload with success)
|
# Download mdf/ldf nd check if files are new (donwload with success)
|
||||||
scp "crm.bim-it.pl:/var/opt/mssql/data/$mdfName" ./Temp/
|
scp "crm.bim-it.pl:/var/opt/mssql/data/$mdfName" ./Temp/
|
||||||
if (((Get-Date) - ((Get-Item ./Temp/$mdfName).LastWriteTime)).TotalMinutes -gt 5) {
|
if (((Get-Date) - ((Get-Item ./Temp/$mdfName).LastWriteTime)).TotalMinutes -gt 5) {
|
||||||
Write-Host "Error: $mdfName was not downloaded correctly."
|
Write-Host "Error: $mdfName was not downloaded correctly."
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
scp "crm.bim-it.pl:/var/opt/mssql/data/$ldfName" ./Temp/
|
scp "crm.bim-it.pl:/var/opt/mssql/data/$ldfName" ./Temp/
|
||||||
if (((Get-Date) - ((Get-Item ./Temp/$ldfName).LastWriteTime)).TotalMinutes -gt 5) {
|
if (((Get-Date) - ((Get-Item ./Temp/$ldfName).LastWriteTime)).TotalMinutes -gt 5) {
|
||||||
Write-Host "Error: $ldfName was not downloaded correctly."
|
Write-Host "Error: $ldfName was not downloaded correctly."
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#drop existing database
|
#drop existing database
|
||||||
DropDatabase $containerId $database $sqlPass;
|
DropDatabase $containerId $database $sqlPass;
|
||||||
if ((IsDatabaseExists $containerId $database $sqlPass) -eq 'yes') {
|
if ((IsDatabaseExists $containerId $database $sqlPass) -eq 'yes') {
|
||||||
Write-Host "Error: $database still exists (drop error)"
|
Write-Host "Error: $database still exists (drop error)"
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#copy new files
|
#copy new files
|
||||||
CopyFile $containerId $mdfName
|
CopyFile $containerId $mdfName
|
||||||
CopyFile $containerId $ldfName
|
CopyFile $containerId $ldfName
|
||||||
#attach databases in container
|
#attach databases in container
|
||||||
AttachDatabase $containerId $database $sqlPass $mdfName $ldfName;
|
AttachDatabase $containerId $database $sqlPass $mdfName $ldfName;
|
||||||
if ((IsDatabaseExists $containerId $database $sqlPass) -eq 'no') {
|
if ((IsDatabaseExists $containerId $database $sqlPass) -eq 'no') {
|
||||||
Write-Host "Error: $database still not exists (attach error)"
|
Write-Host "Error: $database still not exists (attach error)"
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Write-Host "OK";
|
Write-Host "OK";
|
||||||
});
|
});
|
||||||
Write-Host "All databases restored!";
|
Write-Host "All databases restored!";
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using WebAPI.Models;
|
using WebAPI.Models;
|
||||||
|
|
||||||
namespace WebAPI
|
namespace WebAPI
|
||||||
{
|
{
|
||||||
public class AppDbContext : DbContext
|
public class AppDbContext : DbContext
|
||||||
{
|
{
|
||||||
public DbSet<User> Users { get; set; }
|
public DbSet<User> Users { get; set; }
|
||||||
public DbSet<Layer> Layers { get; set; }
|
public DbSet<Layer> Layers { get; set; }
|
||||||
public DbSet<Record> Records { get; set; }
|
public DbSet<Record> Records { get; set; }
|
||||||
|
|
||||||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly Microsoft.Extensions.Logging.LoggerFactory _myLoggerFactory =
|
public static readonly Microsoft.Extensions.Logging.LoggerFactory _myLoggerFactory =
|
||||||
new LoggerFactory(new[] {
|
new LoggerFactory(new[] {
|
||||||
new Microsoft.Extensions.Logging.Debug.DebugLoggerProvider()
|
new Microsoft.Extensions.Logging.Debug.DebugLoggerProvider()
|
||||||
});
|
});
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseLoggerFactory(_myLoggerFactory);
|
optionsBuilder.UseLoggerFactory(_myLoggerFactory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,72 +1,72 @@
|
|||||||
using Google.Apis.Auth;
|
using Google.Apis.Auth;
|
||||||
using Google.Apis.Http;
|
using Google.Apis.Http;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
|
using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WebAPI.Models;
|
using WebAPI.Models;
|
||||||
|
|
||||||
namespace WebAPI.Controllers
|
namespace WebAPI.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
// [Authorize]
|
// [Authorize]
|
||||||
public class AuthController : Controller
|
public class AuthController : Controller
|
||||||
{
|
{
|
||||||
private readonly AppDbContext db;
|
private readonly AppDbContext db;
|
||||||
private readonly IConfiguration configuration;
|
private readonly IConfiguration configuration;
|
||||||
public AuthController(
|
public AuthController(
|
||||||
AppDbContext _db, IConfiguration _configuration)
|
AppDbContext _db, IConfiguration _configuration)
|
||||||
{ db = _db; configuration = _configuration; }
|
{ db = _db; configuration = _configuration; }
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("apiToken")]
|
[Route("apiToken")]
|
||||||
public async Task<IActionResult> apiToken([FromBody] string credential)
|
public async Task<IActionResult> apiToken([FromBody] string credential)
|
||||||
{
|
{
|
||||||
var settings = new GoogleJsonWebSignature.ValidationSettings()
|
var settings = new GoogleJsonWebSignature.ValidationSettings()
|
||||||
{
|
{
|
||||||
Audience = new List<string> { configuration.GetValue<string>("GoogleClientId") }
|
Audience = new List<string> { configuration.GetValue<string>("GoogleClientId") }
|
||||||
};
|
};
|
||||||
var payload = await GoogleJsonWebSignature.ValidateAsync(credential, settings);
|
var payload = await GoogleJsonWebSignature.ValidateAsync(credential, settings);
|
||||||
var user = db.Users.Where(x => x.Email == payload.Email).FirstOrDefault();
|
var user = db.Users.Where(x => x.Email == payload.Email).FirstOrDefault();
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
return Ok(JWTGenerator(user));
|
return Ok(JWTGenerator(user));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private dynamic JWTGenerator(User user)
|
private dynamic JWTGenerator(User user)
|
||||||
{
|
{
|
||||||
var key = Encoding.ASCII.GetBytes(configuration.GetValue<string>("Secret"));
|
var key = Encoding.ASCII.GetBytes(configuration.GetValue<string>("Secret"));
|
||||||
var expirationTime = DateTime.UtcNow.AddMinutes(5);
|
var expirationTime = DateTime.UtcNow.AddMinutes(5);
|
||||||
var tokenDescriptor = new SecurityTokenDescriptor
|
var tokenDescriptor = new SecurityTokenDescriptor
|
||||||
{
|
{
|
||||||
Subject = new ClaimsIdentity(new[]
|
Subject = new ClaimsIdentity(new[]
|
||||||
{
|
{
|
||||||
new Claim("Id", Guid.NewGuid().ToString()),
|
new Claim("Id", Guid.NewGuid().ToString()),
|
||||||
new Claim(JwtRegisteredClaimNames.Sub, user.Id.ToString()),
|
new Claim(JwtRegisteredClaimNames.Sub, user.Id.ToString()),
|
||||||
new Claim(JwtRegisteredClaimNames.Jti,
|
new Claim(JwtRegisteredClaimNames.Jti,
|
||||||
Guid.NewGuid().ToString())
|
Guid.NewGuid().ToString())
|
||||||
}),
|
}),
|
||||||
Expires = expirationTime,
|
Expires = expirationTime,
|
||||||
SigningCredentials = new SigningCredentials
|
SigningCredentials = new SigningCredentials
|
||||||
(new SymmetricSecurityKey(key),
|
(new SymmetricSecurityKey(key),
|
||||||
SecurityAlgorithms.HmacSha512Signature)
|
SecurityAlgorithms.HmacSha512Signature)
|
||||||
};
|
};
|
||||||
var tokenHandler = new JwtSecurityTokenHandler();
|
var tokenHandler = new JwtSecurityTokenHandler();
|
||||||
var token = tokenHandler.CreateToken(tokenDescriptor);
|
var token = tokenHandler.CreateToken(tokenDescriptor);
|
||||||
var jwtToken = tokenHandler.WriteToken(token);
|
var jwtToken = tokenHandler.WriteToken(token);
|
||||||
var stringToken = tokenHandler.WriteToken(token);
|
var stringToken = tokenHandler.WriteToken(token);
|
||||||
return new { token = stringToken, id = user.Id, expirationTime };
|
return new { token = stringToken, id = user.Id, expirationTime };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,182 +1,182 @@
|
|||||||
using Google.Apis.Auth;
|
using Google.Apis.Auth;
|
||||||
using Google.Apis.Http;
|
using Google.Apis.Http;
|
||||||
using Google.Apis.Sheets.v4;
|
using Google.Apis.Sheets.v4;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
|
using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WebAPI.dataParsers;
|
using WebAPI.dataParsers;
|
||||||
using WebAPI.Exports;
|
using WebAPI.Exports;
|
||||||
using WebAPI.Models;
|
using WebAPI.Models;
|
||||||
|
|
||||||
namespace WebAPI.Controllers
|
namespace WebAPI.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class LayersController : Controller
|
public class LayersController : Controller
|
||||||
{
|
{
|
||||||
private readonly AppDbContext db;
|
private readonly AppDbContext db;
|
||||||
private SpreadsheetsResource.ValuesResource googleSheetValues;
|
private SpreadsheetsResource.ValuesResource googleSheetValues;
|
||||||
private GoogleDriveHelper googleDriveHelper;
|
private GoogleDriveHelper googleDriveHelper;
|
||||||
private readonly IConfiguration configuration;
|
private readonly IConfiguration configuration;
|
||||||
public LayersController(
|
public LayersController(
|
||||||
AppDbContext _db,
|
AppDbContext _db,
|
||||||
GoogleSheetsHelper _googleSheetsHelper,
|
GoogleSheetsHelper _googleSheetsHelper,
|
||||||
GoogleDriveHelper _googleDriveHelper,
|
GoogleDriveHelper _googleDriveHelper,
|
||||||
IConfiguration _configuration)
|
IConfiguration _configuration)
|
||||||
{
|
{
|
||||||
db = _db;
|
db = _db;
|
||||||
googleSheetValues = _googleSheetsHelper.Service.Spreadsheets.Values;
|
googleSheetValues = _googleSheetsHelper.Service.Spreadsheets.Values;
|
||||||
googleDriveHelper = _googleDriveHelper;
|
googleDriveHelper = _googleDriveHelper;
|
||||||
configuration = _configuration;
|
configuration = _configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetAll()
|
public IActionResult GetAll()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Ok(db.Layers.Where(x => !x.IsDeleted).ToList());
|
return Ok(db.Layers.Where(x => !x.IsDeleted).ToList());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return BadRequest(e.ToString());
|
return BadRequest(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult Save(Layer input)
|
public IActionResult Save(Layer input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Request.Headers.TryGetValue("userId", out var value);
|
Request.Headers.TryGetValue("userId", out var value);
|
||||||
Guid currentUserId = new Guid(value!);
|
Guid currentUserId = new Guid(value!);
|
||||||
return Ok(AddLayer(input, currentUserId).Id);
|
return Ok(AddLayer(input, currentUserId).Id);
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
return BadRequest(e.ToString());
|
return BadRequest(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{id}")]
|
[Route("{id}")]
|
||||||
public IActionResult Get(Guid id)
|
public IActionResult Get(Guid id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Ok(db.Layers
|
return Ok(db.Layers
|
||||||
.Include(x => x.CreatedBy)
|
.Include(x => x.CreatedBy)
|
||||||
.Include(x => x.Records)
|
.Include(x => x.Records)
|
||||||
.Where(x => x.Id == id && !x.IsDeleted).First());
|
.Where(x => x.Id == id && !x.IsDeleted).First());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return BadRequest(e.ToString());
|
return BadRequest(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("parseGoogleSheet/{sheetId}")]
|
[Route("parseGoogleSheet/{sheetId}")]
|
||||||
public IActionResult ParseGoogleSheet(string sheetId)
|
public IActionResult ParseGoogleSheet(string sheetId)
|
||||||
{
|
{
|
||||||
|
|
||||||
string sheetName = "KOSZTY";
|
string sheetName = "KOSZTY";
|
||||||
|
|
||||||
Layer layer = new Layer();
|
Layer layer = new Layer();
|
||||||
layer.Source = "GoogleSheet";
|
layer.Source = "GoogleSheet";
|
||||||
layer.Number = db.Layers.Count() + 1;
|
layer.Number = db.Layers.Count() + 1;
|
||||||
var parser = new googleSheetParser(googleSheetValues);
|
var parser = new googleSheetParser(googleSheetValues);
|
||||||
dynamic parsedSheet = parser.parse(sheetId);
|
dynamic parsedSheet = parser.parse(sheetId);
|
||||||
layer.Records = parsedSheet.records;
|
layer.Records = parsedSheet.records;
|
||||||
layer.Name = $"W{layer.Number}-I-{sheetName}-{parsedSheet.date}-{DateTime.Now.ToString("yyyyMMddHHmm")}";
|
layer.Name = $"W{layer.Number}-I-{sheetName}-{parsedSheet.date}-{DateTime.Now.ToString("yyyyMMddHHmm")}";
|
||||||
|
|
||||||
return Ok(layer);
|
return Ok(layer);
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[DisableRequestSizeLimit]
|
[DisableRequestSizeLimit]
|
||||||
[Route("parseFile")]
|
[Route("parseFile")]
|
||||||
public IActionResult ParseFile()
|
public IActionResult ParseFile()
|
||||||
{
|
{
|
||||||
var parser = new csvParser();
|
var parser = new csvParser();
|
||||||
return Ok(parser.parse(Request.Form.Files[0]));
|
return Ok(parser.parse(Request.Form.Files[0]));
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("exportToGoogleSheet/{id}")]
|
[Route("exportToGoogleSheet/{id}")]
|
||||||
public IActionResult ExportToGoogleSheet(Guid id)
|
public IActionResult ExportToGoogleSheet(Guid id)
|
||||||
{
|
{
|
||||||
Layer layer = db.Layers
|
Layer layer = db.Layers
|
||||||
.Include(x => x.Records)
|
.Include(x => x.Records)
|
||||||
.Where(x => x.Id == id && !x.IsDeleted).First();
|
.Where(x => x.Id == id && !x.IsDeleted).First();
|
||||||
|
|
||||||
var export = new googleSheetExport(googleDriveHelper, googleSheetValues);
|
var export = new googleSheetExport(googleDriveHelper, googleSheetValues);
|
||||||
export.export(layer);
|
export.export(layer);
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("autoImport/{apiKey}")]
|
[Route("autoImport/{apiKey}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult autoImport(string apiKey)
|
public IActionResult autoImport(string apiKey)
|
||||||
{
|
{
|
||||||
if (Request.Host.Value != "localhost:5400" || apiKey != configuration["apiKey"])
|
if (Request.Host.Value != "localhost:5400" || apiKey != configuration["apiKey"])
|
||||||
{
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
string sheetId = "1G_Hu8DTP-PSPNXTaVYhc_ppnTQi6HWoA4oXSSdUmM9E";
|
string sheetId = "1G_Hu8DTP-PSPNXTaVYhc_ppnTQi6HWoA4oXSSdUmM9E";
|
||||||
string sheetName = "KOSZTY";
|
string sheetName = "KOSZTY";
|
||||||
|
|
||||||
Layer layer = new Layer();
|
Layer layer = new Layer();
|
||||||
layer.Source = "GoogleSheet";
|
layer.Source = "GoogleSheet";
|
||||||
layer.Number = db.Layers.Count() + 1;
|
layer.Number = db.Layers.Count() + 1;
|
||||||
var parser = new googleSheetParser(googleSheetValues);
|
var parser = new googleSheetParser(googleSheetValues);
|
||||||
dynamic parsedSheet = parser.parse(sheetId);
|
dynamic parsedSheet = parser.parse(sheetId);
|
||||||
layer.Records = parsedSheet.records;
|
layer.Records = parsedSheet.records;
|
||||||
layer.Name = $"W{layer.Number}-I-{sheetName}-{parsedSheet.date}-{DateTime.Now.ToString("yyyyMMddHHmm")}";
|
layer.Name = $"W{layer.Number}-I-{sheetName}-{parsedSheet.date}-{DateTime.Now.ToString("yyyyMMddHHmm")}";
|
||||||
AddLayer(layer, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"));
|
AddLayer(layer, Guid.Parse("F392209E-123E-4651-A5A4-0B1D6CF9FF9D"));
|
||||||
|
|
||||||
return Ok("OK");
|
return Ok("OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
private Layer AddLayer(Layer input, Guid currentUserId)
|
private Layer AddLayer(Layer input, Guid currentUserId)
|
||||||
{
|
{
|
||||||
input.Number = db.Layers.Count() + 1;
|
input.Number = db.Layers.Count() + 1;
|
||||||
input.CreatedById = currentUserId;
|
input.CreatedById = currentUserId;
|
||||||
input.ModifiedById = currentUserId;
|
input.ModifiedById = currentUserId;
|
||||||
input.CreatedAt = DateTime.UtcNow;
|
input.CreatedAt = DateTime.UtcNow;
|
||||||
input.ModifiedAt = DateTime.UtcNow;
|
input.ModifiedAt = DateTime.UtcNow;
|
||||||
|
|
||||||
db.Layers.Add(input);
|
db.Layers.Add(input);
|
||||||
SaveRecords(input.Id, input.Records!, currentUserId);
|
SaveRecords(input.Id, input.Records!, currentUserId);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveRecords(Guid id, ICollection<Models.Record> records, Guid currentUserId)
|
private void SaveRecords(Guid id, ICollection<Models.Record> records, Guid currentUserId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<Guid> ids = new List<Guid>();
|
List<Guid> ids = new List<Guid>();
|
||||||
foreach (Record record in records)
|
foreach (Record record in records)
|
||||||
{
|
{
|
||||||
record.CreatedById = currentUserId;
|
record.CreatedById = currentUserId;
|
||||||
record.CreatedAt = DateTime.UtcNow;
|
record.CreatedAt = DateTime.UtcNow;
|
||||||
record.ModifiedById = currentUserId;
|
record.ModifiedById = currentUserId;
|
||||||
record.ModifiedAt = DateTime.UtcNow;
|
record.ModifiedAt = DateTime.UtcNow;
|
||||||
record.LayerId= id;
|
record.LayerId= id;
|
||||||
|
|
||||||
db.Records.Add(record);
|
db.Records.Add(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,36 +1,36 @@
|
|||||||
using Google.Apis.Auth;
|
using Google.Apis.Auth;
|
||||||
using Google.Apis.Http;
|
using Google.Apis.Http;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
|
using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WebAPI.Models;
|
using WebAPI.Models;
|
||||||
|
|
||||||
namespace WebAPI.Controllers
|
namespace WebAPI.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class PingController : Controller
|
public class PingController : Controller
|
||||||
{
|
{
|
||||||
private readonly IConfiguration configuration;
|
private readonly IConfiguration configuration;
|
||||||
public PingController(
|
public PingController(
|
||||||
IConfiguration _configuration)
|
IConfiguration _configuration)
|
||||||
{
|
{
|
||||||
configuration = _configuration;
|
configuration = _configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("Ping")]
|
[Route("Ping")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult Ping()
|
public IActionResult Ping()
|
||||||
{
|
{
|
||||||
return Ok(configuration["PONG"]);
|
return Ok(configuration["PONG"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,33 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CsvHelper" Version="30.0.1" />
|
<PackageReference Include="CsvHelper" Version="30.0.1" />
|
||||||
<PackageReference Include="Google.Apis.Auth" Version="1.58.0" />
|
<PackageReference Include="Google.Apis.Auth" Version="1.58.0" />
|
||||||
<PackageReference Include="Google.Apis.Drive.v3" Version="1.58.0.2859" />
|
<PackageReference Include="Google.Apis.Drive.v3" Version="1.58.0.2859" />
|
||||||
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.58.0.2826" />
|
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.58.0.2826" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Update="client_secrets.Development.json">
|
<Content Update="client_secrets.Development.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,50 +1,50 @@
|
|||||||
using Google.Apis.Drive.v3.Data;
|
using Google.Apis.Drive.v3.Data;
|
||||||
using Google.Apis.Sheets.v4;
|
using Google.Apis.Sheets.v4;
|
||||||
using Google.Apis.Sheets.v4.Data;
|
using Google.Apis.Sheets.v4.Data;
|
||||||
using WebAPI.Models;
|
using WebAPI.Models;
|
||||||
using static Google.Apis.Drive.v3.FilesResource;
|
using static Google.Apis.Drive.v3.FilesResource;
|
||||||
|
|
||||||
namespace WebAPI.Exports
|
namespace WebAPI.Exports
|
||||||
{
|
{
|
||||||
public class googleSheetExport
|
public class googleSheetExport
|
||||||
{
|
{
|
||||||
private GoogleDriveHelper googleDriveHelper;
|
private GoogleDriveHelper googleDriveHelper;
|
||||||
private SpreadsheetsResource.ValuesResource googleSheetValues;
|
private SpreadsheetsResource.ValuesResource googleSheetValues;
|
||||||
public googleSheetExport(GoogleDriveHelper _googleDriveHelper, SpreadsheetsResource.ValuesResource _googleSheetValues)
|
public googleSheetExport(GoogleDriveHelper _googleDriveHelper, SpreadsheetsResource.ValuesResource _googleSheetValues)
|
||||||
{
|
{
|
||||||
googleDriveHelper = _googleDriveHelper;
|
googleDriveHelper = _googleDriveHelper;
|
||||||
googleSheetValues = _googleSheetValues;
|
googleSheetValues = _googleSheetValues;
|
||||||
}
|
}
|
||||||
public void export(Layer layer)
|
public void export(Layer layer)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<IList<object>> data = new List<IList<object>>() { new List<object>() { layer.Name!, layer.Number! } };
|
List<IList<object>> data = new List<IList<object>>() { new List<object>() { layer.Name!, layer.Number! } };
|
||||||
foreach (Record record in layer.Records!)
|
foreach (Record record in layer.Records!)
|
||||||
{
|
{
|
||||||
data.Add(new List<object> { record.Code!, record.Value });
|
data.Add(new List<object> { record.Code!, record.Value });
|
||||||
}
|
}
|
||||||
|
|
||||||
Google.Apis.Drive.v3.Data.File body = new Google.Apis.Drive.v3.Data.File();
|
Google.Apis.Drive.v3.Data.File body = new Google.Apis.Drive.v3.Data.File();
|
||||||
body.Name = $"export-{DateTime.Now}";
|
body.Name = $"export-{DateTime.Now}";
|
||||||
body.MimeType = "application/vnd.google-apps.spreadsheet";
|
body.MimeType = "application/vnd.google-apps.spreadsheet";
|
||||||
body.Parents = new List<string> { "1c5GBQmsIoj6a9L-JYFTaLEZ3EfkbQHPt" };
|
body.Parents = new List<string> { "1c5GBQmsIoj6a9L-JYFTaLEZ3EfkbQHPt" };
|
||||||
CreateRequest request = googleDriveHelper.Service.Files.Create(body);
|
CreateRequest request = googleDriveHelper.Service.Files.Create(body);
|
||||||
var file = request.Execute();
|
var file = request.Execute();
|
||||||
|
|
||||||
string sheetId = file.Id;
|
string sheetId = file.Id;
|
||||||
var range = $"Sheet1!A1:B${data.Count}";
|
var range = $"Sheet1!A1:B${data.Count}";
|
||||||
|
|
||||||
ValueRange valueRange = new ValueRange() { Values = data};
|
ValueRange valueRange = new ValueRange() { Values = data};
|
||||||
|
|
||||||
var updateRequest = googleSheetValues.Update(valueRange, sheetId, range);
|
var updateRequest = googleSheetValues.Update(valueRange, sheetId, range);
|
||||||
updateRequest.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.RAW;
|
updateRequest.ValueInputOption = SpreadsheetsResource.ValuesResource.UpdateRequest.ValueInputOptionEnum.RAW;
|
||||||
updateRequest.Execute();
|
updateRequest.Execute();
|
||||||
|
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
using Google.Apis.Auth.OAuth2;
|
using Google.Apis.Auth.OAuth2;
|
||||||
using Google.Apis.Drive.v3;
|
using Google.Apis.Drive.v3;
|
||||||
using Google.Apis.Services;
|
using Google.Apis.Services;
|
||||||
|
|
||||||
namespace WebAPI
|
namespace WebAPI
|
||||||
{
|
{
|
||||||
public class GoogleDriveHelper
|
public class GoogleDriveHelper
|
||||||
{
|
{
|
||||||
public DriveService Service { get; set; }
|
public DriveService Service { get; set; }
|
||||||
const string APPLICATION_NAME = "Diuna";
|
const string APPLICATION_NAME = "Diuna";
|
||||||
static readonly string[] Scopes = { DriveService.Scope.Drive };
|
static readonly string[] Scopes = { DriveService.Scope.Drive };
|
||||||
public GoogleDriveHelper()
|
public GoogleDriveHelper()
|
||||||
{
|
{
|
||||||
InitializeService();
|
InitializeService();
|
||||||
}
|
}
|
||||||
private void InitializeService()
|
private void InitializeService()
|
||||||
{
|
{
|
||||||
var credential = GetCredentialsFromFile();
|
var credential = GetCredentialsFromFile();
|
||||||
Service = new DriveService(new BaseClientService.Initializer()
|
Service = new DriveService(new BaseClientService.Initializer()
|
||||||
{
|
{
|
||||||
HttpClientInitializer = credential,
|
HttpClientInitializer = credential,
|
||||||
ApplicationName = APPLICATION_NAME
|
ApplicationName = APPLICATION_NAME
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private GoogleCredential GetCredentialsFromFile()
|
private GoogleCredential GetCredentialsFromFile()
|
||||||
{
|
{
|
||||||
string fileName = "client_secrets.json";
|
string fileName = "client_secrets.json";
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fileName = "client_secrets.Development.json";
|
fileName = "client_secrets.Development.json";
|
||||||
#endif
|
#endif
|
||||||
GoogleCredential credential;
|
GoogleCredential credential;
|
||||||
using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
|
using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
|
||||||
{
|
{
|
||||||
credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
|
credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
|
||||||
}
|
}
|
||||||
return credential;
|
return credential;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
using Google.Apis.Auth.OAuth2;
|
using Google.Apis.Auth.OAuth2;
|
||||||
using Google.Apis.Services;
|
using Google.Apis.Services;
|
||||||
using Google.Apis.Sheets.v4;
|
using Google.Apis.Sheets.v4;
|
||||||
|
|
||||||
namespace WebAPI
|
namespace WebAPI
|
||||||
{
|
{
|
||||||
public class GoogleSheetsHelper
|
public class GoogleSheetsHelper
|
||||||
{
|
{
|
||||||
public SheetsService Service { get; set; }
|
public SheetsService Service { get; set; }
|
||||||
const string APPLICATION_NAME = "Diuna";
|
const string APPLICATION_NAME = "Diuna";
|
||||||
static readonly string[] Scopes = { SheetsService.Scope.Spreadsheets };
|
static readonly string[] Scopes = { SheetsService.Scope.Spreadsheets };
|
||||||
public GoogleSheetsHelper()
|
public GoogleSheetsHelper()
|
||||||
{
|
{
|
||||||
InitializeService();
|
InitializeService();
|
||||||
}
|
}
|
||||||
private void InitializeService()
|
private void InitializeService()
|
||||||
{
|
{
|
||||||
var credential = GetCredentialsFromFile();
|
var credential = GetCredentialsFromFile();
|
||||||
Service = new SheetsService(new BaseClientService.Initializer()
|
Service = new SheetsService(new BaseClientService.Initializer()
|
||||||
{
|
{
|
||||||
HttpClientInitializer = credential,
|
HttpClientInitializer = credential,
|
||||||
ApplicationName = APPLICATION_NAME
|
ApplicationName = APPLICATION_NAME
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private GoogleCredential GetCredentialsFromFile()
|
private GoogleCredential GetCredentialsFromFile()
|
||||||
{
|
{
|
||||||
string fileName = "client_secrets.json";
|
string fileName = "client_secrets.json";
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fileName = "client_secrets.Development.json";
|
fileName = "client_secrets.Development.json";
|
||||||
#endif
|
#endif
|
||||||
GoogleCredential credential;
|
GoogleCredential credential;
|
||||||
using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
|
using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
|
||||||
{
|
{
|
||||||
credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
|
credential = GoogleCredential.FromStream(stream).CreateScoped(Scopes);
|
||||||
}
|
}
|
||||||
return credential;
|
return credential;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
102
WebAPI/Migrations/20221205190148_Initial.Designer.cs
generated
102
WebAPI/Migrations/20221205190148_Initial.Designer.cs
generated
@@ -1,51 +1,51 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using WebAPI;
|
using WebAPI;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
[Migration("20221205190148_Initial")]
|
[Migration("20221205190148_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.0")
|
.HasAnnotation("ProductVersion", "7.0.0")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.User", b =>
|
modelBuilder.Entity("WebAPI.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,36 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Initial : Migration
|
public partial class Initial : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Users",
|
name: "Users",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
UserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
UserName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Users", x => x.Id);
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Users");
|
name: "Users");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,192 +1,192 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using WebAPI;
|
using WebAPI;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
[Migration("20221211210507_DataSetsAndDataRows")]
|
[Migration("20221211210507_DataSetsAndDataRows")]
|
||||||
partial class DataSetsAndDataRows
|
partial class DataSetsAndDataRows
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.0")
|
.HasAnnotation("ProductVersion", "7.0.0")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<Guid?>("DataSetId")
|
b.Property<Guid?>("DataSetId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Desc1")
|
b.Property<string>("Desc1")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc2")
|
b.Property<string>("Desc2")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc3")
|
b.Property<string>("Desc3")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc4")
|
b.Property<string>("Desc4")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc5")
|
b.Property<string>("Desc5")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<string>("MPK")
|
b.Property<string>("MPK")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<float>("Value")
|
b.Property<float>("Value")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("DataSetId");
|
b.HasIndex("DataSetId");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("DataRows");
|
b.ToTable("DataRows");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Number")
|
b.Property<string>("Number")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("DataSets");
|
b.ToTable("DataSets");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.User", b =>
|
modelBuilder.Entity("WebAPI.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.DataSet", null)
|
b.HasOne("WebAPI.Models.DataSet", null)
|
||||||
.WithMany("DataRows")
|
.WithMany("DataRows")
|
||||||
.HasForeignKey("DataSetId");
|
.HasForeignKey("DataSetId");
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("DataRows");
|
b.Navigation("DataRows");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,121 +1,121 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class DataSetsAndDataRows : Migration
|
public partial class DataSetsAndDataRows : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "DataSets",
|
name: "DataSets",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_DataSets", x => x.Id);
|
table.PrimaryKey("PK_DataSets", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataSets_Users_CreatedById",
|
name: "FK_DataSets_Users_CreatedById",
|
||||||
column: x => x.CreatedById,
|
column: x => x.CreatedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataSets_Users_ModifiedById",
|
name: "FK_DataSets_Users_ModifiedById",
|
||||||
column: x => x.ModifiedById,
|
column: x => x.ModifiedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "DataRows",
|
name: "DataRows",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
MPK = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
MPK = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Value = table.Column<float>(type: "real", nullable: false),
|
Value = table.Column<float>(type: "real", nullable: false),
|
||||||
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_DataRows", x => x.Id);
|
table.PrimaryKey("PK_DataRows", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataRows_DataSets_DataSetId",
|
name: "FK_DataRows_DataSets_DataSetId",
|
||||||
column: x => x.DataSetId,
|
column: x => x.DataSetId,
|
||||||
principalTable: "DataSets",
|
principalTable: "DataSets",
|
||||||
principalColumn: "Id");
|
principalColumn: "Id");
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataRows_Users_CreatedById",
|
name: "FK_DataRows_Users_CreatedById",
|
||||||
column: x => x.CreatedById,
|
column: x => x.CreatedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataRows_Users_ModifiedById",
|
name: "FK_DataRows_Users_ModifiedById",
|
||||||
column: x => x.ModifiedById,
|
column: x => x.ModifiedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataRows_CreatedById",
|
name: "IX_DataRows_CreatedById",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "CreatedById");
|
column: "CreatedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataRows_DataSetId",
|
name: "IX_DataRows_DataSetId",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "DataSetId");
|
column: "DataSetId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataRows_ModifiedById",
|
name: "IX_DataRows_ModifiedById",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "ModifiedById");
|
column: "ModifiedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataSets_CreatedById",
|
name: "IX_DataSets_CreatedById",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
column: "CreatedById");
|
column: "CreatedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataSets_ModifiedById",
|
name: "IX_DataSets_ModifiedById",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
column: "ModifiedById");
|
column: "ModifiedById");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "DataRows");
|
name: "DataRows");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "DataSets");
|
name: "DataSets");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,197 +1,197 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using WebAPI;
|
using WebAPI;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
[Migration("20221219163620_RenameFields")]
|
[Migration("20221219163620_RenameFields")]
|
||||||
partial class RenameFields
|
partial class RenameFields
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.0")
|
.HasAnnotation("ProductVersion", "7.0.0")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Code")
|
b.Property<string>("Code")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<Guid?>("DataSetId")
|
b.Property<Guid?>("DataSetId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Desc1")
|
b.Property<string>("Desc1")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc2")
|
b.Property<string>("Desc2")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc3")
|
b.Property<string>("Desc3")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc4")
|
b.Property<string>("Desc4")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc5")
|
b.Property<string>("Desc5")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<float>("Value")
|
b.Property<float>("Value")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("DataSetId");
|
b.HasIndex("DataSetId");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("DataRows");
|
b.ToTable("DataRows");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<int?>("Number")
|
b.Property<int?>("Number")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("Source")
|
b.Property<string>("Source")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("DataSets");
|
b.ToTable("DataSets");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.User", b =>
|
modelBuilder.Entity("WebAPI.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.DataSet", null)
|
b.HasOne("WebAPI.Models.DataSet", null)
|
||||||
.WithMany("DataRows")
|
.WithMany("DataRows")
|
||||||
.HasForeignKey("DataSetId");
|
.HasForeignKey("DataSetId");
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("DataRows");
|
b.Navigation("DataRows");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,73 +1,73 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class RenameFields : Migration
|
public partial class RenameFields : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.RenameColumn(
|
migrationBuilder.RenameColumn(
|
||||||
name: "MPK",
|
name: "MPK",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
newName: "Code");
|
newName: "Code");
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
migrationBuilder.AlterColumn<int>(
|
||||||
name: "Number",
|
name: "Number",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
type: "int",
|
type: "int",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
oldClrType: typeof(string),
|
oldClrType: typeof(string),
|
||||||
oldType: "nvarchar(max)");
|
oldType: "nvarchar(max)");
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
migrationBuilder.AlterColumn<string>(
|
||||||
name: "Name",
|
name: "Name",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
type: "nvarchar(max)",
|
type: "nvarchar(max)",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: "",
|
defaultValue: "",
|
||||||
oldClrType: typeof(string),
|
oldClrType: typeof(string),
|
||||||
oldType: "nvarchar(max)",
|
oldType: "nvarchar(max)",
|
||||||
oldNullable: true);
|
oldNullable: true);
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
migrationBuilder.AddColumn<string>(
|
||||||
name: "Source",
|
name: "Source",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
type: "nvarchar(max)",
|
type: "nvarchar(max)",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: "");
|
defaultValue: "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropColumn(
|
migrationBuilder.DropColumn(
|
||||||
name: "Source",
|
name: "Source",
|
||||||
table: "DataSets");
|
table: "DataSets");
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
migrationBuilder.RenameColumn(
|
||||||
name: "Code",
|
name: "Code",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
newName: "MPK");
|
newName: "MPK");
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
migrationBuilder.AlterColumn<string>(
|
||||||
name: "Number",
|
name: "Number",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
type: "nvarchar(max)",
|
type: "nvarchar(max)",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
oldClrType: typeof(int),
|
oldClrType: typeof(int),
|
||||||
oldType: "int");
|
oldType: "int");
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
migrationBuilder.AlterColumn<string>(
|
||||||
name: "Name",
|
name: "Name",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
type: "nvarchar(max)",
|
type: "nvarchar(max)",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
oldClrType: typeof(string),
|
oldClrType: typeof(string),
|
||||||
oldType: "nvarchar(max)");
|
oldType: "nvarchar(max)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,199 +1,199 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using WebAPI;
|
using WebAPI;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
[Migration("20221221165749_DataSetIdOnDataRow")]
|
[Migration("20221221165749_DataSetIdOnDataRow")]
|
||||||
partial class DataSetIdOnDataRow
|
partial class DataSetIdOnDataRow
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.0")
|
.HasAnnotation("ProductVersion", "7.0.0")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Code")
|
b.Property<string>("Code")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<Guid>("DataSetId")
|
b.Property<Guid>("DataSetId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Desc1")
|
b.Property<string>("Desc1")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc2")
|
b.Property<string>("Desc2")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc3")
|
b.Property<string>("Desc3")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc4")
|
b.Property<string>("Desc4")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc5")
|
b.Property<string>("Desc5")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<float>("Value")
|
b.Property<float>("Value")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("DataSetId");
|
b.HasIndex("DataSetId");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("DataRows");
|
b.ToTable("DataRows");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<int?>("Number")
|
b.Property<int?>("Number")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("Source")
|
b.Property<string>("Source")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("DataSets");
|
b.ToTable("DataSets");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.User", b =>
|
modelBuilder.Entity("WebAPI.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
modelBuilder.Entity("WebAPI.Models.DataRow", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.DataSet", null)
|
b.HasOne("WebAPI.Models.DataSet", null)
|
||||||
.WithMany("DataRows")
|
.WithMany("DataRows")
|
||||||
.HasForeignKey("DataSetId")
|
.HasForeignKey("DataSetId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
modelBuilder.Entity("WebAPI.Models.DataSet", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("DataRows");
|
b.Navigation("DataRows");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,60 +1,60 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class DataSetIdOnDataRow : Migration
|
public partial class DataSetIdOnDataRow : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropForeignKey(
|
migrationBuilder.DropForeignKey(
|
||||||
name: "FK_DataRows_DataSets_DataSetId",
|
name: "FK_DataRows_DataSets_DataSetId",
|
||||||
table: "DataRows");
|
table: "DataRows");
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<Guid>(
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
name: "DataSetId",
|
name: "DataSetId",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
type: "uniqueidentifier",
|
type: "uniqueidentifier",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
oldClrType: typeof(Guid),
|
oldClrType: typeof(Guid),
|
||||||
oldType: "uniqueidentifier",
|
oldType: "uniqueidentifier",
|
||||||
oldNullable: true);
|
oldNullable: true);
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
migrationBuilder.AddForeignKey(
|
||||||
name: "FK_DataRows_DataSets_DataSetId",
|
name: "FK_DataRows_DataSets_DataSetId",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "DataSetId",
|
column: "DataSetId",
|
||||||
principalTable: "DataSets",
|
principalTable: "DataSets",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropForeignKey(
|
migrationBuilder.DropForeignKey(
|
||||||
name: "FK_DataRows_DataSets_DataSetId",
|
name: "FK_DataRows_DataSets_DataSetId",
|
||||||
table: "DataRows");
|
table: "DataRows");
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<Guid>(
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
name: "DataSetId",
|
name: "DataSetId",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
type: "uniqueidentifier",
|
type: "uniqueidentifier",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
oldClrType: typeof(Guid),
|
oldClrType: typeof(Guid),
|
||||||
oldType: "uniqueidentifier");
|
oldType: "uniqueidentifier");
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
migrationBuilder.AddForeignKey(
|
||||||
name: "FK_DataRows_DataSets_DataSetId",
|
name: "FK_DataRows_DataSets_DataSetId",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "DataSetId",
|
column: "DataSetId",
|
||||||
principalTable: "DataSets",
|
principalTable: "DataSets",
|
||||||
principalColumn: "Id");
|
principalColumn: "Id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,199 +1,199 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using WebAPI;
|
using WebAPI;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
[Migration("20230106095427_RenameModels")]
|
[Migration("20230106095427_RenameModels")]
|
||||||
partial class RenameModels
|
partial class RenameModels
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.0")
|
.HasAnnotation("ProductVersion", "7.0.0")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<int?>("Number")
|
b.Property<int?>("Number")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("Source")
|
b.Property<string>("Source")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("Layers");
|
b.ToTable("Layers");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Code")
|
b.Property<string>("Code")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Desc1")
|
b.Property<string>("Desc1")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc2")
|
b.Property<string>("Desc2")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc3")
|
b.Property<string>("Desc3")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc4")
|
b.Property<string>("Desc4")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc5")
|
b.Property<string>("Desc5")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<Guid>("LayerId")
|
b.Property<Guid>("LayerId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<float>("Value")
|
b.Property<float>("Value")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("LayerId");
|
b.HasIndex("LayerId");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("Records");
|
b.ToTable("Records");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.User", b =>
|
modelBuilder.Entity("WebAPI.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.Layer", null)
|
b.HasOne("WebAPI.Models.Layer", null)
|
||||||
.WithMany("Records")
|
.WithMany("Records")
|
||||||
.HasForeignKey("LayerId")
|
.HasForeignKey("LayerId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Records");
|
b.Navigation("Records");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,227 +1,227 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class RenameModels : Migration
|
public partial class RenameModels : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "DataRows");
|
name: "DataRows");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "DataSets");
|
name: "DataSets");
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Layers",
|
name: "Layers",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
Number = table.Column<int>(type: "int", nullable: false),
|
Number = table.Column<int>(type: "int", nullable: false),
|
||||||
Source = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Source = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Layers", x => x.Id);
|
table.PrimaryKey("PK_Layers", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Layers_Users_CreatedById",
|
name: "FK_Layers_Users_CreatedById",
|
||||||
column: x => x.CreatedById,
|
column: x => x.CreatedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Layers_Users_ModifiedById",
|
name: "FK_Layers_Users_ModifiedById",
|
||||||
column: x => x.ModifiedById,
|
column: x => x.ModifiedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Records",
|
name: "Records",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Value = table.Column<float>(type: "real", nullable: false),
|
Value = table.Column<float>(type: "real", nullable: false),
|
||||||
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
LayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
LayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Records", x => x.Id);
|
table.PrimaryKey("PK_Records", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Records_Layers_LayerId",
|
name: "FK_Records_Layers_LayerId",
|
||||||
column: x => x.LayerId,
|
column: x => x.LayerId,
|
||||||
principalTable: "Layers",
|
principalTable: "Layers",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Records_Users_CreatedById",
|
name: "FK_Records_Users_CreatedById",
|
||||||
column: x => x.CreatedById,
|
column: x => x.CreatedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_Records_Users_ModifiedById",
|
name: "FK_Records_Users_ModifiedById",
|
||||||
column: x => x.ModifiedById,
|
column: x => x.ModifiedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Layers_CreatedById",
|
name: "IX_Layers_CreatedById",
|
||||||
table: "Layers",
|
table: "Layers",
|
||||||
column: "CreatedById");
|
column: "CreatedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Layers_ModifiedById",
|
name: "IX_Layers_ModifiedById",
|
||||||
table: "Layers",
|
table: "Layers",
|
||||||
column: "ModifiedById");
|
column: "ModifiedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Records_CreatedById",
|
name: "IX_Records_CreatedById",
|
||||||
table: "Records",
|
table: "Records",
|
||||||
column: "CreatedById");
|
column: "CreatedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Records_LayerId",
|
name: "IX_Records_LayerId",
|
||||||
table: "Records",
|
table: "Records",
|
||||||
column: "LayerId");
|
column: "LayerId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Records_ModifiedById",
|
name: "IX_Records_ModifiedById",
|
||||||
table: "Records",
|
table: "Records",
|
||||||
column: "ModifiedById");
|
column: "ModifiedById");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Records");
|
name: "Records");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Layers");
|
name: "Layers");
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "DataSets",
|
name: "DataSets",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
Number = table.Column<int>(type: "int", nullable: false),
|
Number = table.Column<int>(type: "int", nullable: false),
|
||||||
Source = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
Source = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_DataSets", x => x.Id);
|
table.PrimaryKey("PK_DataSets", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataSets_Users_CreatedById",
|
name: "FK_DataSets_Users_CreatedById",
|
||||||
column: x => x.CreatedById,
|
column: x => x.CreatedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataSets_Users_ModifiedById",
|
name: "FK_DataSets_Users_ModifiedById",
|
||||||
column: x => x.ModifiedById,
|
column: x => x.ModifiedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "DataRows",
|
name: "DataRows",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||||
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||||
Value = table.Column<float>(type: "real", nullable: false)
|
Value = table.Column<float>(type: "real", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_DataRows", x => x.Id);
|
table.PrimaryKey("PK_DataRows", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataRows_DataSets_DataSetId",
|
name: "FK_DataRows_DataSets_DataSetId",
|
||||||
column: x => x.DataSetId,
|
column: x => x.DataSetId,
|
||||||
principalTable: "DataSets",
|
principalTable: "DataSets",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataRows_Users_CreatedById",
|
name: "FK_DataRows_Users_CreatedById",
|
||||||
column: x => x.CreatedById,
|
column: x => x.CreatedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_DataRows_Users_ModifiedById",
|
name: "FK_DataRows_Users_ModifiedById",
|
||||||
column: x => x.ModifiedById,
|
column: x => x.ModifiedById,
|
||||||
principalTable: "Users",
|
principalTable: "Users",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id",
|
||||||
onDelete: ReferentialAction.NoAction);
|
onDelete: ReferentialAction.NoAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataRows_CreatedById",
|
name: "IX_DataRows_CreatedById",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "CreatedById");
|
column: "CreatedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataRows_DataSetId",
|
name: "IX_DataRows_DataSetId",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "DataSetId");
|
column: "DataSetId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataRows_ModifiedById",
|
name: "IX_DataRows_ModifiedById",
|
||||||
table: "DataRows",
|
table: "DataRows",
|
||||||
column: "ModifiedById");
|
column: "ModifiedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataSets_CreatedById",
|
name: "IX_DataSets_CreatedById",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
column: "CreatedById");
|
column: "CreatedById");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_DataSets_ModifiedById",
|
name: "IX_DataSets_ModifiedById",
|
||||||
table: "DataSets",
|
table: "DataSets",
|
||||||
column: "ModifiedById");
|
column: "ModifiedById");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,196 +1,196 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using WebAPI;
|
using WebAPI;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace WebAPI.Migrations
|
namespace WebAPI.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AppDbContext))]
|
[DbContext(typeof(AppDbContext))]
|
||||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||||
{
|
{
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "7.0.0")
|
.HasAnnotation("ProductVersion", "7.0.0")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<int?>("Number")
|
b.Property<int?>("Number")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("Source")
|
b.Property<string>("Source")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("Layers");
|
b.ToTable("Layers");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Code")
|
b.Property<string>("Code")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("CreatedById")
|
b.Property<Guid>("CreatedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<string>("Desc1")
|
b.Property<string>("Desc1")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc2")
|
b.Property<string>("Desc2")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc3")
|
b.Property<string>("Desc3")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc4")
|
b.Property<string>("Desc4")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("Desc5")
|
b.Property<string>("Desc5")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
b.Property<bool>("IsDeleted")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<Guid>("LayerId")
|
b.Property<Guid>("LayerId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("ModifiedAt")
|
b.Property<DateTime>("ModifiedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<Guid>("ModifiedById")
|
b.Property<Guid>("ModifiedById")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<float>("Value")
|
b.Property<float>("Value")
|
||||||
.HasColumnType("real");
|
.HasColumnType("real");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreatedById");
|
b.HasIndex("CreatedById");
|
||||||
|
|
||||||
b.HasIndex("LayerId");
|
b.HasIndex("LayerId");
|
||||||
|
|
||||||
b.HasIndex("ModifiedById");
|
b.HasIndex("ModifiedById");
|
||||||
|
|
||||||
b.ToTable("Records");
|
b.ToTable("Records");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.User", b =>
|
modelBuilder.Entity("WebAPI.Models.User", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
b.Property<DateTime>("CreatedAt")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
b.Property<string>("UserName")
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
.HasColumnType("nvarchar(50)");
|
.HasColumnType("nvarchar(50)");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
modelBuilder.Entity("WebAPI.Models.Record", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
b.HasOne("WebAPI.Models.User", "CreatedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CreatedById")
|
.HasForeignKey("CreatedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.Layer", null)
|
b.HasOne("WebAPI.Models.Layer", null)
|
||||||
.WithMany("Records")
|
.WithMany("Records")
|
||||||
.HasForeignKey("LayerId")
|
.HasForeignKey("LayerId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
b.HasOne("WebAPI.Models.User", "ModifiedBy")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ModifiedById")
|
.HasForeignKey("ModifiedById")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
b.Navigation("CreatedBy");
|
||||||
|
|
||||||
b.Navigation("ModifiedBy");
|
b.Navigation("ModifiedBy");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
modelBuilder.Entity("WebAPI.Models.Layer", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Records");
|
b.Navigation("Records");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace WebAPI.Models
|
namespace WebAPI.Models
|
||||||
{
|
{
|
||||||
public class Layer
|
public class Layer
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[Key]
|
[Key]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int? Number { get; set; }
|
public int? Number { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public string? Source { get; set; }
|
public string? Source { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime CreatedAt { get; set; }
|
public DateTime CreatedAt { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime ModifiedAt { get; set; }
|
public DateTime ModifiedAt { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public bool IsDeleted { get; set; }
|
public bool IsDeleted { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
#region Relations
|
#region Relations
|
||||||
public ICollection<Record>? Records { get; set; }
|
public ICollection<Record>? Records { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public Guid CreatedById { get; set; }
|
public Guid CreatedById { get; set; }
|
||||||
public User? CreatedBy { get; set; }
|
public User? CreatedBy { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public Guid ModifiedById { get; set; }
|
public Guid ModifiedById { get; set; }
|
||||||
public User? ModifiedBy { get; set; }
|
public User? ModifiedBy { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace WebAPI.Models
|
namespace WebAPI.Models
|
||||||
{
|
{
|
||||||
public class Record
|
public class Record
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[Key]
|
[Key]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public string? Code { get; set; }
|
public string? Code { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public float Value { get; set; }
|
public float Value { get; set; }
|
||||||
//Description fields
|
//Description fields
|
||||||
public string? Desc1 { get; set; }
|
public string? Desc1 { get; set; }
|
||||||
public string? Desc2 { get; set; }
|
public string? Desc2 { get; set; }
|
||||||
public string? Desc3 { get; set; }
|
public string? Desc3 { get; set; }
|
||||||
public string? Desc4 { get; set; }
|
public string? Desc4 { get; set; }
|
||||||
public string? Desc5 { get; set; }
|
public string? Desc5 { get; set; }
|
||||||
public DateTime CreatedAt { get; set; }
|
public DateTime CreatedAt { get; set; }
|
||||||
public DateTime ModifiedAt { get; set; }
|
public DateTime ModifiedAt { get; set; }
|
||||||
public bool IsDeleted { get; set; }
|
public bool IsDeleted { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
#region Relations
|
#region Relations
|
||||||
[Required]
|
[Required]
|
||||||
public Guid CreatedById { get; set; }
|
public Guid CreatedById { get; set; }
|
||||||
public User? CreatedBy { get; set; }
|
public User? CreatedBy { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public Guid ModifiedById { get; set; }
|
public Guid ModifiedById { get; set; }
|
||||||
public User? ModifiedBy { get; set; }
|
public User? ModifiedBy { get; set; }
|
||||||
public Guid LayerId { get; set; }
|
public Guid LayerId { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace WebAPI.Models
|
namespace WebAPI.Models
|
||||||
{
|
{
|
||||||
public class User
|
public class User
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
[Key]
|
[Key]
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public string? Email { get; set; }
|
public string? Email { get; set; }
|
||||||
[StringLength(50)]
|
[StringLength(50)]
|
||||||
public string? UserName { get; set; }
|
public string? UserName { get; set; }
|
||||||
public DateTime CreatedAt { get; set; }
|
public DateTime CreatedAt { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,87 +1,87 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WebAPI;
|
using WebAPI;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
var connectionString = builder.Configuration.GetConnectionString("SQLDatabase");
|
var connectionString = builder.Configuration.GetConnectionString("SQLDatabase");
|
||||||
builder.Services.AddDbContext<AppDbContext>(x => x.UseSqlServer(connectionString));
|
builder.Services.AddDbContext<AppDbContext>(x => x.UseSqlServer(connectionString));
|
||||||
|
|
||||||
builder.Services.AddCors(options =>
|
builder.Services.AddCors(options =>
|
||||||
{
|
{
|
||||||
options.AddPolicy("CORSPolicy", builder =>
|
options.AddPolicy("CORSPolicy", builder =>
|
||||||
{
|
{
|
||||||
builder.WithOrigins("http://localhost:4200")
|
builder.WithOrigins("http://localhost:4200")
|
||||||
.AllowAnyMethod()
|
.AllowAnyMethod()
|
||||||
.AllowAnyHeader()
|
.AllowAnyHeader()
|
||||||
.AllowCredentials();
|
.AllowCredentials();
|
||||||
|
|
||||||
builder.WithOrigins("https://diuna.bim-it.pl")
|
builder.WithOrigins("https://diuna.bim-it.pl")
|
||||||
.AllowAnyMethod()
|
.AllowAnyMethod()
|
||||||
.AllowAnyHeader()
|
.AllowAnyHeader()
|
||||||
.AllowCredentials();
|
.AllowCredentials();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
builder.Services.AddAuthentication(options =>
|
builder.Services.AddAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
|
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
}).AddJwtBearer(options =>
|
}).AddJwtBearer(options =>
|
||||||
{
|
{
|
||||||
options.TokenValidationParameters = new TokenValidationParameters
|
options.TokenValidationParameters = new TokenValidationParameters
|
||||||
{
|
{
|
||||||
ValidateIssuer = false,
|
ValidateIssuer = false,
|
||||||
ValidateAudience = false,
|
ValidateAudience = false,
|
||||||
ValidateLifetime = true,
|
ValidateLifetime = true,
|
||||||
ValidateIssuerSigningKey = true,
|
ValidateIssuerSigningKey = true,
|
||||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Secret"]))
|
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["Secret"]))
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
|
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
builder.Services.AddSingleton(typeof(GoogleSheetsHelper));
|
builder.Services.AddSingleton(typeof(GoogleSheetsHelper));
|
||||||
builder.Services.AddSingleton(typeof(GoogleDriveHelper));
|
builder.Services.AddSingleton(typeof(GoogleDriveHelper));
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
app.Use(async (context, next) =>
|
app.Use(async (context, next) =>
|
||||||
{
|
{
|
||||||
string token = context.Request.Headers["Authorization"].ToString();
|
string token = context.Request.Headers["Authorization"].ToString();
|
||||||
if (token.Length > 0) {
|
if (token.Length > 0) {
|
||||||
var handler = new JwtSecurityTokenHandler();
|
var handler = new JwtSecurityTokenHandler();
|
||||||
var data = handler.ReadJwtToken(token.Split(' ')[1]);
|
var data = handler.ReadJwtToken(token.Split(' ')[1]);
|
||||||
context.Request.Headers.Add("UserId", new Microsoft.Extensions.Primitives.StringValues(data.Subject));
|
context.Request.Headers.Add("UserId", new Microsoft.Extensions.Primitives.StringValues(data.Subject));
|
||||||
}
|
}
|
||||||
await next(context);
|
await next(context);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
// app.UseHttpsRedirection();
|
// app.UseHttpsRedirection();
|
||||||
app.UseCors("CORSPolicy");
|
app.UseCors("CORSPolicy");
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||||
"iisSettings": {
|
"iisSettings": {
|
||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
"iisExpress": {
|
"iisExpress": {
|
||||||
"applicationUrl": "http://localhost:12241",
|
"applicationUrl": "http://localhost:12241",
|
||||||
"sslPort": 44358
|
"sslPort": 44358
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"WebAPI": {
|
"WebAPI": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "https://localhost:7009;http://localhost:5183",
|
"applicationUrl": "https://localhost:7009;http://localhost:5183",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"PONG": "Development",
|
"PONG": "Development",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"SQLDatabase": "Server=tcp:127.0.0.1,1433;Initial Catalog=diuna;Persist Security Info=False;User ID=SA;Password=v](8Lc|RfG;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;"
|
"SQLDatabase": "Server=tcp:127.0.0.1,1433;Initial Catalog=diuna;Persist Security Info=False;User ID=SA;Password=v](8Lc|RfG;MultipleActiveResultSets=False;Encrypt=False;TrustServerCertificate=False;Connection Timeout=30;"
|
||||||
},
|
},
|
||||||
"GoogleClientId": "107631825312-bkfe438ehr9k9ecb2h76g802tj6advma.apps.googleusercontent.com",
|
"GoogleClientId": "107631825312-bkfe438ehr9k9ecb2h76g802tj6advma.apps.googleusercontent.com",
|
||||||
"Secret": "8393AF8EAEF8478CB738D44858690F9C7E2D19F65896DD9FBAA3EB2A6F493E80",
|
"Secret": "8393AF8EAEF8478CB738D44858690F9C7E2D19F65896DD9FBAA3EB2A6F493E80",
|
||||||
"apiKey": "9ecb2h76g802tF65896DD9FBAA3EB2A6F493",
|
"apiKey": "9ecb2h76g802tF65896DD9FBAA3EB2A6F493",
|
||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://localhost:5400"
|
"Url": "http://localhost:5400"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"PONG": "#{PING}#",
|
"PONG": "#{PING}#",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"SQLDatabase": "#{db-connection-string}#"
|
"SQLDatabase": "#{db-connection-string}#"
|
||||||
},
|
},
|
||||||
"GoogleClientId": "#{google-backend-login-client-id}#",
|
"GoogleClientId": "#{google-backend-login-client-id}#",
|
||||||
"Secret": "#{google-backend-login-secret}#",
|
"Secret": "#{google-backend-login-secret}#",
|
||||||
"apiKey": "#{api-key}#",
|
"apiKey": "#{api-key}#",
|
||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "#{api-local-url}#"
|
"Url": "#{api-local-url}#"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +1,53 @@
|
|||||||
using CsvHelper;
|
using CsvHelper;
|
||||||
using CsvHelper.Configuration;
|
using CsvHelper.Configuration;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||||
using System.Formats.Asn1;
|
using System.Formats.Asn1;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WebAPI.Models;
|
using WebAPI.Models;
|
||||||
|
|
||||||
namespace WebAPI.dataParsers
|
namespace WebAPI.dataParsers
|
||||||
{
|
{
|
||||||
public class csvParser
|
public class csvParser
|
||||||
{
|
{
|
||||||
public List<Record> parse(IFormFile file)
|
public List<Record> parse(IFormFile file)
|
||||||
{
|
{
|
||||||
var info = CultureInfo.CurrentCulture;
|
var info = CultureInfo.CurrentCulture;
|
||||||
|
|
||||||
List<Record> records = new List<Record>();
|
List<Record> records = new List<Record>();
|
||||||
|
|
||||||
var stream = new StreamReader(file.OpenReadStream());
|
var stream = new StreamReader(file.OpenReadStream());
|
||||||
string content = stream.ReadToEnd();
|
string content = stream.ReadToEnd();
|
||||||
|
|
||||||
List<string> lines = content.Split("\n").ToList();
|
List<string> lines = content.Split("\n").ToList();
|
||||||
List<List<string>> data = new List<List<string>>();
|
List<List<string>> data = new List<List<string>>();
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
data.Add(line.Split(";").ToList());
|
data.Add(line.Split(";").ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < data[0].Count; i++)
|
for (int i = 1; i < data[0].Count; i++)
|
||||||
{
|
{
|
||||||
for (int j = 1; j < data.Count; j++) {
|
for (int j = 1; j < data.Count; j++) {
|
||||||
if (data[j][0].Length > 0)
|
if (data[j][0].Length > 0)
|
||||||
{
|
{
|
||||||
float value = float.Parse(data[j][i], CultureInfo.GetCultureInfo("pl-PL"));
|
float value = float.Parse(data[j][i], CultureInfo.GetCultureInfo("pl-PL"));
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
{
|
{
|
||||||
Record record = new Record();
|
Record record = new Record();
|
||||||
record.Id = Guid.NewGuid();
|
record.Id = Guid.NewGuid();
|
||||||
record.Code = data[0][i];
|
record.Code = data[0][i];
|
||||||
record.Desc1 = data[j][0];
|
record.Desc1 = data[j][0];
|
||||||
record.Value = value;
|
record.Value = value;
|
||||||
record.CreatedAt = DateTime.UtcNow;
|
record.CreatedAt = DateTime.UtcNow;
|
||||||
record.ModifiedAt= DateTime.UtcNow;
|
record.ModifiedAt= DateTime.UtcNow;
|
||||||
records.Add(record);
|
records.Add(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,49 @@
|
|||||||
using Google.Apis.Sheets.v4;
|
using Google.Apis.Sheets.v4;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using WebAPI.Models;
|
using WebAPI.Models;
|
||||||
|
|
||||||
namespace WebAPI.dataParsers
|
namespace WebAPI.dataParsers
|
||||||
{
|
{
|
||||||
public class googleSheetParser
|
public class googleSheetParser
|
||||||
{
|
{
|
||||||
private SpreadsheetsResource.ValuesResource googleSheetValues;
|
private SpreadsheetsResource.ValuesResource googleSheetValues;
|
||||||
|
|
||||||
public googleSheetParser(SpreadsheetsResource.ValuesResource _googleSheetValues)
|
public googleSheetParser(SpreadsheetsResource.ValuesResource _googleSheetValues)
|
||||||
{
|
{
|
||||||
googleSheetValues = _googleSheetValues;
|
googleSheetValues = _googleSheetValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public dynamic parse(string sheetId)
|
public dynamic parse(string sheetId)
|
||||||
{
|
{
|
||||||
var range = "Arkusz1!A:B";
|
var range = "Arkusz1!A:B";
|
||||||
|
|
||||||
var request = googleSheetValues.Get(sheetId, range);
|
var request = googleSheetValues.Get(sheetId, range);
|
||||||
var response = request.Execute();
|
var response = request.Execute();
|
||||||
var data = response.Values;
|
var data = response.Values;
|
||||||
|
|
||||||
List<Record> records = new List<Record>();
|
List<Record> records = new List<Record>();
|
||||||
|
|
||||||
string date = (string)data[0][0];
|
string date = (string)data[0][0];
|
||||||
|
|
||||||
for (int i = 1; i < data.Count; i++)
|
for (int i = 1; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
float value = float.Parse(data[i][1].ToString(), CultureInfo.GetCultureInfo("pl-PL"));
|
float value = float.Parse(data[i][1].ToString(), CultureInfo.GetCultureInfo("pl-PL"));
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
{
|
{
|
||||||
Record record = new Record();
|
Record record = new Record();
|
||||||
record.Id = Guid.NewGuid();
|
record.Id = Guid.NewGuid();
|
||||||
record.Code = data[i][0].ToString();
|
record.Code = data[i][0].ToString();
|
||||||
record.Value = value;
|
record.Value = value;
|
||||||
record.CreatedAt = DateTime.UtcNow;
|
record.CreatedAt = DateTime.UtcNow;
|
||||||
record.ModifiedAt = DateTime.UtcNow;
|
record.ModifiedAt = DateTime.UtcNow;
|
||||||
records.Add(record);
|
records.Add(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
records = records,
|
records = records,
|
||||||
date = date
|
date = date
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,79 +1,79 @@
|
|||||||
# ASP.NET
|
# ASP.NET
|
||||||
# Build and test ASP.NET projects.
|
# Build and test ASP.NET projects.
|
||||||
# Add steps that publish symbols, save build artifacts, deploy, and more:
|
# Add steps that publish symbols, save build artifacts, deploy, and more:
|
||||||
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
|
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
buildConfiguration: 'Release'
|
buildConfiguration: 'Release'
|
||||||
targetRuntime: 'linux-x64'
|
targetRuntime: 'linux-x64'
|
||||||
selfContained: false
|
selfContained: false
|
||||||
dotNetFramework: 'net7.0'
|
dotNetFramework: 'net7.0'
|
||||||
dotNetVersion: '7.0.x'
|
dotNetVersion: '7.0.x'
|
||||||
buildId: $(Build.BuildNumber)
|
buildId: $(Build.BuildNumber)
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Start: Build WebAPI
|
# Start: Build WebAPI
|
||||||
- task: UseDotNet@2
|
- task: UseDotNet@2
|
||||||
inputs:
|
inputs:
|
||||||
version: $(dotNetVersion)
|
version: $(dotNetVersion)
|
||||||
- script: dotnet build --configuration $(buildConfiguration) "WebAPI/DiunaBI-WebAPI.csproj"
|
- script: dotnet build --configuration $(buildConfiguration) "WebAPI/DiunaBI-WebAPI.csproj"
|
||||||
displayName: 'Build .NET 6 Application'
|
displayName: 'Build .NET 6 Application'
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
- task: DotNetCoreCLI@2
|
||||||
displayName: 'dotnet publish $(buildConfiguration)'
|
displayName: 'dotnet publish $(buildConfiguration)'
|
||||||
inputs:
|
inputs:
|
||||||
command: publish
|
command: publish
|
||||||
publishWebProjects: True
|
publishWebProjects: True
|
||||||
arguments: '--configuration $(BuildConfiguration) --framework $(dotNetFramework) --runtime $(targetRuntime) --self-contained $(selfContained) --output $(Build.ArtifactStagingDirectory)'
|
arguments: '--configuration $(BuildConfiguration) --framework $(dotNetFramework) --runtime $(targetRuntime) --self-contained $(selfContained) --output $(Build.ArtifactStagingDirectory)'
|
||||||
workingDirectory: 'WebAPI'
|
workingDirectory: 'WebAPI'
|
||||||
zipAfterPublish: False
|
zipAfterPublish: False
|
||||||
- task: DeleteFiles@1
|
- task: DeleteFiles@1
|
||||||
inputs:
|
inputs:
|
||||||
SourceFolder: '$(Build.ArtifactStagingDirectory)/WebAPI'
|
SourceFolder: '$(Build.ArtifactStagingDirectory)/WebAPI'
|
||||||
Contents: |
|
Contents: |
|
||||||
appsettings.Development.json
|
appsettings.Development.json
|
||||||
client_secrets.Development.json
|
client_secrets.Development.json
|
||||||
# End: Build WebAPI
|
# End: Build WebAPI
|
||||||
# Start: Build Frontend
|
# Start: Build Frontend
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: '14.x'
|
versionSpec: '14.x'
|
||||||
displayName: 'Install Node.js'
|
displayName: 'Install Node.js'
|
||||||
- script: |
|
- script: |
|
||||||
npm install -g @angular/cli
|
npm install -g @angular/cli
|
||||||
npm install
|
npm install
|
||||||
ng build --configuration production
|
ng build --configuration production
|
||||||
workingDirectory: 'Frontend'
|
workingDirectory: 'Frontend'
|
||||||
displayName: 'npm install and build'
|
displayName: 'npm install and build'
|
||||||
- task: CopyFiles@2
|
- task: CopyFiles@2
|
||||||
inputs:
|
inputs:
|
||||||
SourceFolder: '$(Build.Repository.LocalPath)/Frontend/dist/diunaBI'
|
SourceFolder: '$(Build.Repository.LocalPath)/Frontend/dist/diunaBI'
|
||||||
Contents: '**'
|
Contents: '**'
|
||||||
TargetFolder: '$(Build.ArtifactStagingDirectory)/Frontend'
|
TargetFolder: '$(Build.ArtifactStagingDirectory)/Frontend'
|
||||||
- task: replacetokens@5
|
- task: replacetokens@5
|
||||||
inputs:
|
inputs:
|
||||||
rootDirectory: '$(Build.ArtifactStagingDirectory)/Frontend'
|
rootDirectory: '$(Build.ArtifactStagingDirectory)/Frontend'
|
||||||
targetFiles: '**/*.js'
|
targetFiles: '**/*.js'
|
||||||
encoding: 'auto'
|
encoding: 'auto'
|
||||||
tokenPattern: 'default'
|
tokenPattern: 'default'
|
||||||
writeBOM: true
|
writeBOM: true
|
||||||
actionOnMissing: 'warn'
|
actionOnMissing: 'warn'
|
||||||
keepToken: true
|
keepToken: true
|
||||||
actionOnNoFiles: 'warn'
|
actionOnNoFiles: 'warn'
|
||||||
enableTransforms: false
|
enableTransforms: false
|
||||||
enableRecursion: false
|
enableRecursion: false
|
||||||
useLegacyPattern: false
|
useLegacyPattern: false
|
||||||
enableTelemetry: true
|
enableTelemetry: true
|
||||||
# End: Build Frontend
|
# End: Build Frontend
|
||||||
# Publish results
|
# Publish results
|
||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
displayName: 'publish artifacts'
|
displayName: 'publish artifacts'
|
||||||
inputs:
|
inputs:
|
||||||
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
version: "3.9"
|
version: "3.9"
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
container_name: "DIUNA-MSSQL-2022"
|
container_name: "DIUNA-MSSQL-2022"
|
||||||
image: "mcr.microsoft.com/mssql/server:2022-latest"
|
image: "mcr.microsoft.com/mssql/server:2022-latest"
|
||||||
ports:
|
ports:
|
||||||
- "1433:1433"
|
- "1433:1433"
|
||||||
environment:
|
environment:
|
||||||
SA_PASSWORD: "v](8Lc|RfG"
|
SA_PASSWORD: "v](8Lc|RfG"
|
||||||
ACCEPT_EULA: "Y"
|
ACCEPT_EULA: "Y"
|
||||||
MSSQL_PID: "Express"
|
MSSQL_PID: "Express"
|
||||||
Reference in New Issue
Block a user