Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrohim-qosimov committed Sep 16, 2024
1 parent 59ba7e1 commit 2e28e22
Show file tree
Hide file tree
Showing 6 changed files with 491 additions and 13 deletions.
9 changes: 0 additions & 9 deletions UrphaCapital.Application/AuthServices/AuthService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,16 @@ public TokenModel GenerateToken(Student user)
SigningCredentials credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);
int expirePeriod = int.Parse(_configuration["JWTSettings:Expire"]!);

string ids = "";

foreach (var a in user.CourseIds)
{
ids += a.ToString() + " ";
}

List<Claim> claims = new List<Claim>()
{
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(JwtRegisteredClaimNames.Iat, EpochTime.GetIntDate(DateTime.UtcNow).ToString(CultureInfo.InvariantCulture), ClaimValueTypes.Integer64),
new Claim("UserId", user.Id.ToString()),
new Claim("Title", user.FullName),
new Claim("Phone", user.PhoneNumber),
new Claim("ids", ids),
new Claim("Address", user.Address),
new Claim("Email", user.Email),
new Claim("Role", user.Role!),
new Claim(ClaimTypes.UserData, ids)
};


Expand Down
5 changes: 4 additions & 1 deletion UrphaCapital.Domain/Entities/Auth/Student.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace UrphaCapital.Domain.Entities.Auth
Expand All @@ -15,7 +16,9 @@ public class Student
public string Email { get; set; }
public string PasswordHash { get; set; }
public string Salt { get; set; }
public List<string> CourseIds { get; set; }

[JsonIgnore]
public List<string>? CourseIds { get; set; }
public string Role { get; set; }
}
}
22 changes: 22 additions & 0 deletions UrphaCapital.Domain/Entities/Payment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UrphaCapital.Domain.Entities.Auth;

namespace UrphaCapital.Domain.Entities
{
public class Payment
{
public long Id { get; set; }
public long StudentId { get; set; }
public Guid CourseId { get; set; }
public decimal Amount { get; set; }

public DateTimeOffset PaymentDate = DateTimeOffset.UtcNow;
public string PaymentStatus { get; set; }
public Student Student { get; set; }
public Course Course { get; set; }
}
}
Loading

0 comments on commit 2e28e22

Please sign in to comment.