Skip to content

Commit

Permalink
Merge pull request #27 from devdanielsun/developer
Browse files Browse the repository at this point in the history
Update Database connection with username and password
  • Loading branch information
devdanielsun authored Jan 10, 2024
2 parents fdd7957 + f7858c0 commit 4087037
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 2 additions & 0 deletions pollor.Server/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ACCEPTED_CORS_DOMAINS=https://127.0.0.1:4200,https://localhost:4200
DB_SERVER=localhost\MSSQLSERVERx
DB_NAME=name
DB_UID=
DB_PASSWORD=
DB_INTEGRATEDSECURITY=True
DB_TRUSTSERVERCERT=True
5 changes: 4 additions & 1 deletion pollor.Server/Services/DBConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ private DBConnection()
{
string dbServer = Environment.GetEnvironmentVariable("DB_SERVER")!;
string dbName = Environment.GetEnvironmentVariable("DB_NAME")!;
string dbUID = Environment.GetEnvironmentVariable("DB_UID")!;
string dbPassword = Environment.GetEnvironmentVariable("DB_PASSWORD")!;
string dbIntegratedSecurity = Environment.GetEnvironmentVariable("DB_INTEGRATEDSECURITY")!;
string dbTrustServerCertificate = Environment.GetEnvironmentVariable("DB_TRUSTSERVERCERT")!;

connectionString = string.Format("Server={0};Initial Catalog={1};Integrated Security={2};TrustServerCertificate={3}", dbServer, dbName, dbIntegratedSecurity, dbTrustServerCertificate);
//connectionString = string.Format("Server={0};Initial Catalog={1};Integrated Security={2};TrustServerCertificate={3}", dbServer, dbName, dbIntegratedSecurity, dbTrustServerCertificate);
connectionString = string.Format("Server={0};Database={1};UID={2};PWD={3};Integrated Security={4};TrustServerCertificate={5}", dbServer, dbName, dbUID, dbPassword, dbIntegratedSecurity, dbTrustServerCertificate);
}

public static DBConnection Instance()
Expand Down
19 changes: 13 additions & 6 deletions pollor.client/src/app/polls/component/polls.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

<h3 id="tableLabel" text-right>Polls</h3>

<p *ngIf="!polls"><em>Loading POLLS...</em></p>
<p *ngIf="!polls || polls == []"><em>Loading POLLS...</em></p>

<table *ngIf="polls" class="table">
<p *ngIf="!polls || polls.length == 0"><em>no poll data found</em></p>

<table *ngIf="polls && polls.length > 0" class="table">
<thead>
<tr>
<th scope="col">Poll id</th>
Expand All @@ -28,9 +30,11 @@ <h3 id="tableLabel" text-right>Polls</h3>

<h3 id="tableLabel" text-right>All unsorted Answers</h3>

<p *ngIf="!answers"><em>Loading ANSWERS...</em></p>
<p *ngIf="!answers || answers == []"><em>Loading ANSWERS...</em></p>

<p *ngIf="!answers || answers.length == 0"><em>no ANSWERS found in database...</em></p>

<table *ngIf="answers" class="table">
<table *ngIf="answers && answers.length > 0" class="table">
<thead>
<tr>
<th scope="col">Answers id</th>
Expand All @@ -53,9 +57,12 @@ <h3 id="tableLabel" text-right>All unsorted Answers</h3>

<h3 id="tableLabel" text-right>All unsorted Votes</h3>

<p *ngIf="!votes"><em>Loading VOTES...</em></p>
<p *ngIf="!votes || votes == []"><em>Loading VOTES...</em></p>

<p *ngIf="!votes || votes.length == 0"><em>no VOTES found in database...</em></p>


<table *ngIf="votes" class="table">
<table *ngIf="votes && votes.length > 0" class="table">
<thead>
<tr>
<th scope="col">Vote id</th>
Expand Down
1 change: 0 additions & 1 deletion pollor.client/src/app/polls/component/polls.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class PollsComponent {
this.getPolls();
this.getAnswers();
this.getVotes();

}

getPolls() {
Expand Down

0 comments on commit 4087037

Please sign in to comment.