Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/TracksifyAPI/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# dotenv files
.env
appsettings.json

# User-specific files
*.rsuser
Expand Down
1 change: 0 additions & 1 deletion backend/TracksifyAPI/Controllers/ProjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using TracksifyAPI.Helpers;
using TracksifyAPI.Interfaces;
using TracksifyAPI.Mappers;
using TracksifyAPI.Models;

namespace TracksifyAPI.Controllers
{
Expand Down
4 changes: 4 additions & 0 deletions backend/TracksifyAPI/Interfaces/IProjectRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ public interface IProjectRepository
Task<bool> ProjectExistsASync(Guid projectId);

Task<ICollection<User>> GetProjectAssigneesASync(Guid projectId);

// PUT Method
Task<Project?> UpdateProjectASync(Guid projectId, Project project);

// POST Methods
Task<Project> CreateProjectASync(Project project);

// DELETE Method
Task DeleteProjectAsync(Project project);

}
Expand Down
11 changes: 6 additions & 5 deletions backend/TracksifyAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,17 @@ async void SeedData(IHost app)
var service = scope.ServiceProvider.GetService<Seed>();
await service!.SeedDataContext();
}
}

}
app.UseSwagger();
app.UseSwaggerUI();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
/*if (app.Environment.IsDevelopment())
{

app.UseSwagger();
app.UseSwaggerUI();
}

*/
app.UseHttpsRedirection();

app.UseAuthentication();
Expand Down
39 changes: 26 additions & 13 deletions backend/TracksifyAPI/Repositories/ProjectRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,16 @@ public async Task<ICollection<User>> GetProjectAssigneesASync(Guid projectId)
return projectassignees;
}

// POST Methods

// PUT Method
/**
* CreateProjectASync - Asynchronously creates a new project
* @project: project to be created
* Return: returns a new Project
* UpdateProjectASync - Asynchronously updates a project
* @projectId: projectid of the project that is to be updated
* @project: project to be updated
* Return: returns the updated project
*/
public async Task<Project> CreateProjectASync(Project project)
{
await _context.Projects.AddAsync(project);
await _context.SaveChangesAsync();
return (project);
}

public async Task<Project?> UpdateProjectASync(Guid projectId, Project project)
{
// how does the cimpiler know the existing project is of type project
var existingProject = await _context.Projects
.FirstOrDefaultAsync(p => p.ProjectId == projectId);

Expand All @@ -147,6 +140,26 @@ public async Task<Project> CreateProjectASync(Project project)
return (existingProject);
}

// POST Methods

/**
* CreateProjectASync - Asynchronously creates a new project
* @project: project to be created
* Return: returns a new Project
*/
public async Task<Project> CreateProjectASync(Project project)
{
await _context.Projects.AddAsync(project);
await _context.SaveChangesAsync();
return (project);
}

// DELETE Method
/**
* CreateProjectASync - Asynchronously deletes a project
* @project: project to be deleted
* Return: returns a new Project
*/
public async Task DeleteProjectAsync(Project project)
{
_context.Projects.Remove(project);
Expand Down
131 changes: 0 additions & 131 deletions backend/TracksifyAPI/Seed.cs

This file was deleted.

4 changes: 2 additions & 2 deletions backend/TracksifyAPI/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
// personalized connection String
"DbConnectionString": "Data Source=DESKTOP-9I51JJ6\\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False"
// Enter your personalized connection String
"DbConnectionString": ""
},
"Logging": {
"LogLevel": {
Expand Down