Get the latest commit and show it on the home page
This commit is contained in:
parent
ffb3e791ab
commit
5d67e92245
23 changed files with 233 additions and 60 deletions
14
Website/Models/Git/Branch.cs
Normal file
14
Website/Models/Git/Branch.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using Website.Data.States.Git;
|
||||
|
||||
namespace Website.Models.Git {
|
||||
public class Branch {
|
||||
|
||||
public Branch(BranchState state) {
|
||||
Name = state.name;
|
||||
Commit = new Commit(state.commit);
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public Commit Commit { get; private set; }
|
||||
}
|
||||
}
|
24
Website/Models/Git/Commit.cs
Normal file
24
Website/Models/Git/Commit.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using Website.Data.States.Git;
|
||||
|
||||
namespace Website.Models.Git {
|
||||
public class Commit {
|
||||
public Commit(CommitState commit) {
|
||||
Id = commit.id;
|
||||
Message = commit.message;
|
||||
Timestamp = commit.timestamp;
|
||||
}
|
||||
|
||||
public Commit(CommitDetailsState commit) {
|
||||
Id = commit.sha;
|
||||
Message = commit.commit.message;
|
||||
Timestamp = commit.commit.author.date;
|
||||
Url = commit.html_url.Replace("/commits/", "/commit/");
|
||||
}
|
||||
|
||||
public string Id { get; }
|
||||
public string Message { get; }
|
||||
public DateTimeOffset Timestamp { get; }
|
||||
public string Url { get; }
|
||||
}
|
||||
}
|
13
Website/Models/Git/Repository.cs
Normal file
13
Website/Models/Git/Repository.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using Website.Data.States.Git;
|
||||
|
||||
namespace Website.Models.Git {
|
||||
public class Repository {
|
||||
public Repository(RepositoryState state) {
|
||||
Name = state.name;
|
||||
Url = state.html_url;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
using Website.Data.States;
|
||||
|
||||
namespace Website.Models {
|
||||
public class GitRepository {
|
||||
public GitRepository(GitRepositoryState state) {
|
||||
Name = state.name;
|
||||
Url = state.html_url;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue