Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
aa15a51
Add Project and solution
Kunikazu723 Oct 6, 2026
98e8169
Create configuration file
Kunikazu723 Oct 6, 2026
98bea93
Add addsettings to output directory
Kunikazu723 Oct 6, 2026
532bcf8
Add format specifier to configuration file
Kunikazu723 Oct 6, 2026
9c8f4f8
Add variables based on appsettings.json to Main
Kunikazu723 Oct 6, 2026
c81a617
Add Dapper and SQLite provider packages
Kunikazu723 Oct 6, 2026
e1ee569
Add more specific DateTime Format values to appsettings.json
Kunikazu723 Oct 6, 2026
ff1d15a
Add basic CodingSession model to map Dapper's queries
Kunikazu723 Oct 6, 2026
366e7fd
Add Spectre Console Package to project
Kunikazu723 Oct 6, 2026
45091ee
Remove blank lines
Kunikazu723 Oct 6, 2026
8ec1bbe
Add user input handling
Kunikazu723 Oct 7, 2026
ba64a5c
Abstract enum-string converting method to handle all types derived fr…
Kunikazu723 Oct 7, 2026
acb8d86
Abstract Options prompt to accept any type of enum
Kunikazu723 Oct 7, 2026
5ef89ca
Add UserInput dependency to UserInterface
Kunikazu723 Oct 7, 2026
c99ac86
Correct access modifier for UserInput
Kunikazu723 Oct 7, 2026
0953716
Add selection prompt for main menu options in UserInterface
Kunikazu723 Oct 7, 2026
740162d
Add services that will talk to the Database
Kunikazu723 Oct 7, 2026
a40ebd5
Add Service dependency to UserInterface
Kunikazu723 Oct 7, 2026
90ae785
Add main loop with options leading to the service
Kunikazu723 Oct 7, 2026
13491c0
Lazy commit
Kunikazu723 Oct 7, 2026
5b50987
Make date format a dependency of validation instead of user input
Kunikazu723 Oct 7, 2026
1962f8f
Add data chronological validation
Kunikazu723 Oct 7, 2026
6bf51be
Add a single method that incorporates other user inputs methods na si…
Kunikazu723 Oct 7, 2026
79cb9f8
Fix unclosed markup tag
Kunikazu723 Oct 7, 2026
dd0dfd7
Move interface to proper directory
Kunikazu723 Oct 9, 2026
1a27e12
Add InsertMany interface memeber
Kunikazu723 Oct 9, 2026
0eca0d3
Correct namespaces
Kunikazu723 Oct 9, 2026
c99cbcd
Implement Seeder members
Kunikazu723 Oct 9, 2026
8d270ed
Create enum to handle random date generation methods
Kunikazu723 Oct 9, 2026
4d35c75
Correct namespace for moved Interface
Kunikazu723 Oct 9, 2026
5b7d938
Add seeder to app's entry point.
Kunikazu723 Oct 9, 2026
5ae6035
Implement Database Intializer
Kunikazu723 Oct 9, 2026
74b271b
Link overall dependencies properly
Kunikazu723 Oct 9, 2026
7e4b990
Implement InsertMany
Kunikazu723 Oct 9, 2026
c48e77d
Implement GetAllItems
Kunikazu723 Oct 9, 2026
a414aa6
Fix Seeder generating repeated dates
Kunikazu723 Oct 9, 2026
6f38250
Implement ViewAllItems
Kunikazu723 Oct 9, 2026
9aafad6
Update .gitignore file to ignore databases
Kunikazu723 Oct 9, 2026
425b9d8
Add more information to exception
Kunikazu723 Oct 11, 2026
0158505
Make Dao interface public to properly follow pre-estabilished pattern
Kunikazu723 Oct 11, 2026
72147a2
Remove CRUD methods from Service class and delegate them to the User …
Kunikazu723 Oct 11, 2026
871af8f
Remove whitespace and unnecessary comments
Kunikazu723 Oct 11, 2026
4be2fc7
Apply little DRY principle
Kunikazu723 Oct 11, 2026
a7e2448
Change user input get date method to be consistent with defined date …
Kunikazu723 Oct 11, 2026
24478e5
Implement InsertItem
Kunikazu723 Oct 11, 2026
830cf2a
Remove unnecessary comment
Kunikazu723 Oct 11, 2026
1490653
Implement Delete and Update
Kunikazu723 Oct 11, 2026
42f626b
Refactor code to make it easier to handle possible database errors
Kunikazu723 Oct 11, 2026
fc466be
Remove Banner presentation where it didn't belong
Kunikazu723 Oct 11, 2026
62241ae
Get new coding session in a single method, avoiding future repetition
Kunikazu723 Oct 11, 2026
3a42647
Apply GetUserCodingSession in Insertion
Kunikazu723 Oct 11, 2026
d1726fc
Change Interface contract to align with ORM paradigms
Kunikazu723 Oct 11, 2026
3623af2
Apply Interface change in derived class
Kunikazu723 Oct 11, 2026
8cac832
Implement session deletion
Kunikazu723 Oct 11, 2026
b9dfab7
Implement remaining Interface member
Kunikazu723 Oct 11, 2026
d514827
Implement session Update
Kunikazu723 Oct 11, 2026
0135b6a
Remove unnecessary comment
Kunikazu723 Oct 11, 2026
b39d4f6
Create method to prompt user for an existing coding session
Kunikazu723 Oct 11, 2026
780a7fb
Implement DeleteSession
Kunikazu723 Oct 11, 2026
6f953f3
Remove misplaced banner
Kunikazu723 Oct 11, 2026
d968fe9
Implement UpdateSession
Kunikazu723 Oct 11, 2026
faa3b68
Add user friendly messages and confirmations
Kunikazu723 Oct 11, 2026
1580731
Remove user input dependency from service to porperly align with sepa…
Kunikazu723 Oct 12, 2026
25285ed
Remove whitespace
Kunikazu723 Oct 12, 2026
14bd9f9
Display invalid option if user somehow selects an invalid Enum
Kunikazu723 Oct 12, 2026
4e7e185
Rewove Dao from Service
Kunikazu723 Oct 12, 2026
ccc5997
Renaming service to Table
Kunikazu723 Oct 12, 2026
d26bd97
Remove unnecessary 'usings'
Kunikazu723 Oct 19, 2026
44eacf4
Add unit tests project
Kunikazu723 Oct 22, 2026
1782d1d
Add Project reference to unit tests
Kunikazu723 Oct 22, 2026
49b7117
Implement Validation Unit Tests
Kunikazu723 Oct 22, 2026
3824f0b
Add stopwatch based method that will be consumed by the UserInterface
Kunikazu723 Oct 22, 2026
7fdf0aa
Make GetUserCodingSession depend on where it should use a stopwatch o…
Kunikazu723 Oct 22, 2026
80042a5
Add Unique constraint violation message that informs the user that he…
Kunikazu723 Oct 22, 2026
6ba2ae1
Implement stopwatch at the LogSession method while also adding visual…
Kunikazu723 Oct 22, 2026
b47d290
Change date time implementation from string to actual DateTime object…
Kunikazu723 Oct 28, 2026
09ccad6
Remove deprecated method
Kunikazu723 Oct 30, 2026
04c8426
Add filter feature
Kunikazu723 Oct 30, 2026
7d87b73
Add QoL where if a filter returns an empty list, the user don't need …
Kunikazu723 Nov 1, 2026
3e83799
Create PromptForNewSession method to allign with PromptForExistingSes…
Kunikazu723 Nov 1, 2026
38507cf
Fix solution file location
Kunikazu723 Nov 1, 2026
4f4e426
Add figlet font to output directory
Kunikazu723 Nov 1, 2026
a6bbe08
Change appsettings.json property to PreserveNewest
Kunikazu723 Nov 1, 2026
17b0b74
Fix figletFont path to use output folder correctly
Kunikazu723 Nov 1, 2026
a41f5cc
Add README.md draft to be completed
Kunikazu723 Nov 1, 2026
ffcf540
Create SeedDatabase option to allow the choice of seeding the database
Kunikazu723 Nov 2, 2026
4444524
Fix wrong sqlite driver package
Kunikazu723 Nov 2, 2026
00ea3c4
Add README.md
Kunikazu723 Nov 2, 2026
e89c2fc
Add emoji to Reflection section
Kunikazu723 Nov 2, 2026
1fec921
quote test
Kunikazu723 Nov 2, 2026
c08bddd
Fix Important box
Kunikazu723 Nov 2, 2026
5bf3dd5
Fix typo in README
Kunikazu723 Nov 2, 2026
bc7589e
Add useful information to README
Kunikazu723 Nov 2, 2026
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# Databse files
*.db

# User-specific files
*.rsuser
Expand Down
31 changes: 31 additions & 0 deletions CodingTracker.Kunikazu723.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.37531.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodingTracker.Kunikazu723", "CodingTracker.Kunikazu723\CodingTracker.Kunikazu723.csproj", "{97EA1958-EE4A-4B55-AAB7-9E57F0A17958}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodingTracker.UnitTests", "CodingTracker.UnitTests\CodingTracker.UnitTests.csproj", "{8DE33EA7-572A-4D3D-A47F-097B04F53AA5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{97EA1958-EE4A-4B55-AAB7-9E57F0A17958}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97EA1958-EE4A-4B55-AAB7-9E57F0A17958}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97EA1958-EE4A-4B55-AAB7-9E57F0A17958}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97EA1958-EE4A-4B55-AAB7-9E57F0A17958}.Release|Any CPU.Build.0 = Release|Any CPU
{8DE33EA7-572A-4D3D-A47F-097B04F53AA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8DE33EA7-572A-4D3D-A47F-097B04F53AA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DE33EA7-572A-4D3D-A47F-097B04F53AA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8DE33EA7-572A-4D3D-A47F-097B04F53AA5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {178835FB-F730-48E9-ACB5-35AB7EE86672}
EndGlobalSection
EndGlobal
28 changes: 28 additions & 0 deletions CodingTracker.Kunikazu723/CodingTracker.Kunikazu723.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.89" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.14" />
<PackageReference Include="Spectre.Console" Version="0.57.2" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="FigletFonts\smkeyboard.flf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
77 changes: 77 additions & 0 deletions CodingTracker.Kunikazu723/Dao/CodingSessionDao.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using CodingTracker.Kunikazu723.Dao.Interfaces;
using CodingTracker.Kunikazu723.Models;
using Dapper;
using Microsoft.Data.Sqlite;

namespace CodingTracker.Kunikazu723.Dao
{
public class CodingSessionDao : IDao<CodingSession>
{
private readonly string _connectionString;

public CodingSessionDao(string connectionString)
{
_connectionString = connectionString;
}

public void DeleteItemById(CodingSession codingSession)
{
using var connection = new SqliteConnection(_connectionString);
var sql = """
DELETE FROM CodingSessions WHERE Id = @Id
""";
connection.Execute(sql, codingSession);
}

public List<CodingSession> GetAllItems()
{
using var connection = new SqliteConnection(_connectionString);
string sql = """
SELECT * FROM CodingSessions
""";
return connection.Query<CodingSession>(sql).ToList();
}

public CodingSession? GetItemById(int id)
{
using var connection = new SqliteConnection(_connectionString);
var sql = """
SELECT * FROM CodingSessions WHERE Id = @itemId
""";
return connection.QuerySingleOrDefault<CodingSession>(sql, new { itemId = id });
}

public void InsertItem(CodingSession item)
{
using var connection = new SqliteConnection(_connectionString);
var sql = """
INSERT INTO CodingSessions (StartTime, EndTime) VALUES (@StartTime, @EndTime)
""";
connection.Execute(sql, item);
}

public void InsertMany(List<CodingSession> collection)
{
using var connection = new SqliteConnection(_connectionString);
connection.Open();

using var transaction = connection.BeginTransaction();
connection.Execute("""
INSERT INTO CodingSessions (StartTime, EndTime)
VALUES (@StartTime, @EndTime)
""", collection, transaction);
transaction.Commit();
}

public void UpdateItemById(CodingSession newItem)
{
using var connection = new SqliteConnection(_connectionString);
var sql = """
UPDATE CodingSessions
SET StartTime = @StartTime, EndTime = @EndTime
WHERE Id = @Id
""";
connection.Execute(sql, newItem);
}
}
}
12 changes: 12 additions & 0 deletions CodingTracker.Kunikazu723/Dao/Interfaces/IDao.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace CodingTracker.Kunikazu723.Dao.Interfaces
{
public interface IDao<T> where T : class
{
List<T> GetAllItems();
T? GetItemById(int id);
void InsertItem(T item);
void UpdateItemById(T newItem);
void DeleteItemById(T item);
void InsertMany(List<T> items);
}
}
26 changes: 26 additions & 0 deletions CodingTracker.Kunikazu723/DatabaseInitializer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Dapper;
using Microsoft.Data.Sqlite;

namespace CodingTracker.Kunikazu723
{
public class DatabaseInitializer
{
private readonly string _connectionString;
public DatabaseInitializer(string connectionString)
{
_connectionString = connectionString;
}

public void Initialize()
{
using var connection = new SqliteConnection(_connectionString);
connection.Execute("""
CREATE TABLE IF NOT EXISTS CodingSessions (
Id INTEGER PRIMARY KEY AUTOINCREMENT,
StartTime TEXT UNIQUE NOT NULL,
EndTime TEXT UNIQUE NOT NULL
)
""");
}
}
}
13 changes: 13 additions & 0 deletions CodingTracker.Kunikazu723/Enums/DateEnums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace CodingTracker.Kunikazu723.Enums
{
public class DateEnums
{
public enum TimeType
{
Day,
Hour,
Minute,
Second
}
}
}
25 changes: 25 additions & 0 deletions CodingTracker.Kunikazu723/Enums/Filters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodingTracker.Kunikazu723.Enums
{
public static class Filters
{
public enum FilterType
{
Days,
Weeks,
Months,
Years,
}

public enum FilterOrder
{
Ascending,
Descending,
}
}
}
19 changes: 19 additions & 0 deletions CodingTracker.Kunikazu723/Enums/MenuEnums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.RegularExpressions;

namespace CodingTracker.Kunikazu723.Enums
{
internal static class MenuEnums
{
public enum MainMenuOptions
{
ViewSessions,
LogSessions,
UpdateSession,
DeleteSession,
Exit
}

public static string OptionToString<T>(T option) where T: struct, Enum => Regex.Replace(option.ToString(), "([A-Z])", " $1").Trim();

}
}
Loading
Loading