Compare commits
No commits in common. "feature/SaveFirebaseNotifications" and "master" have entirely different histories.
feature/Sa
...
master
@ -1,30 +0,0 @@
|
|||||||
using Abp.Domain.Entities.Auditing;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BCS.BMC.BMC.FirebaseCloudMessages
|
|
||||||
{
|
|
||||||
[Table("FirebaseCloudMessageDetails")]
|
|
||||||
public class FirebaseCloudMessageDetails : FullAuditedEntity
|
|
||||||
{
|
|
||||||
public const int SenderNameMaxLength = 32;
|
|
||||||
public const int SenderImageurlMaxLength = 256;
|
|
||||||
public const int FcmTokenMaxLength = 512;
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int UserId { get; set; }
|
|
||||||
[MaxLength(FcmTokenMaxLength)]
|
|
||||||
public string FcmToken { get; set; }
|
|
||||||
[MaxLength(SenderImageurlMaxLength)]
|
|
||||||
public string SenderImageurl { get; set; }
|
|
||||||
[MaxLength(SenderNameMaxLength)]
|
|
||||||
public string SenderName { get; set; }
|
|
||||||
public DateTime? MessageSentDateTime { get; set; }
|
|
||||||
public bool Status { get; set; }
|
|
||||||
public string Message { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
using Abp.Domain.Entities.Auditing;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BCS.BMC.BMC.FirebaseCloudMessages
|
|
||||||
{
|
|
||||||
[Table("FirebaseToken")]
|
|
||||||
public class FirebaseToken : FullAuditedEntity
|
|
||||||
{
|
|
||||||
public const int HostNameMaxLength = 512;
|
|
||||||
public int? UserId { get; set; }
|
|
||||||
[MaxLength(HostNameMaxLength)]
|
|
||||||
public string HostName { get; set; }
|
|
||||||
public string FcmToken { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,6 @@ using BCS.BMC.Authorization.Roles;
|
|||||||
using BCS.BMC.Authorization.Users;
|
using BCS.BMC.Authorization.Users;
|
||||||
using BCS.BMC.MultiTenancy;
|
using BCS.BMC.MultiTenancy;
|
||||||
using BCS.BMC.BMC.CompanyMasters;
|
using BCS.BMC.BMC.CompanyMasters;
|
||||||
using BCS.BMC.BMC.FirebaseCloudMessages;
|
|
||||||
|
|
||||||
namespace BCS.BMC.EntityFrameworkCore
|
namespace BCS.BMC.EntityFrameworkCore
|
||||||
{
|
{
|
||||||
@ -12,8 +11,7 @@ namespace BCS.BMC.EntityFrameworkCore
|
|||||||
{
|
{
|
||||||
/* Define a DbSet for each entity of the application */
|
/* Define a DbSet for each entity of the application */
|
||||||
public virtual DbSet<CompanyMaster> CompanyMasters { get; set; }
|
public virtual DbSet<CompanyMaster> CompanyMasters { get; set; }
|
||||||
public virtual DbSet<FirebaseCloudMessageDetails> FirebaseCloudMessageDetail { get; set; }
|
|
||||||
public virtual DbSet<FirebaseToken> FirebaseTokens { get; set; }
|
|
||||||
public BMCDbContext(DbContextOptions<BMCDbContext> options)
|
public BMCDbContext(DbContextOptions<BMCDbContext> options)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,45 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace BCS.BMC.Migrations
|
|
||||||
{
|
|
||||||
public partial class FirebaeCloudMessageDetails : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "FirebaseCloudMessageDetails",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
UserId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
FcmToken = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
|
|
||||||
SenderImageurl = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
||||||
SenderName = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: true),
|
|
||||||
MessageSentDateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
||||||
Status = table.Column<bool>(type: "bit", nullable: false),
|
|
||||||
Message = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
|
|
||||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
||||||
LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
|
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
|
||||||
DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
|
|
||||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_FirebaseCloudMessageDetails", x => x.Id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "FirebaseCloudMessageDetails");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace BCS.BMC.Migrations
|
|
||||||
{
|
|
||||||
public partial class FirebaseToken : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "FirebaseToken",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
UserId = table.Column<int>(type: "int", nullable: true),
|
|
||||||
HostName = table.Column<string>(type: "nvarchar(512)", maxLength: 512, nullable: true),
|
|
||||||
FcmToken = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
||||||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
||||||
CreatorUserId = table.Column<long>(type: "bigint", nullable: true),
|
|
||||||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
||||||
LastModifierUserId = table.Column<long>(type: "bigint", nullable: true),
|
|
||||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
|
||||||
DeleterUserId = table.Column<long>(type: "bigint", nullable: true),
|
|
||||||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_FirebaseToken", x => x.Id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "FirebaseToken");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,19 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace BCS.BMC.Migrations
|
|
||||||
{
|
|
||||||
public partial class RemoveIdFrom_FirebaseToken : Migration
|
|
||||||
{
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1613,108 +1613,6 @@ namespace BCS.BMC.Migrations
|
|||||||
b.ToTable("CompanyMaster");
|
b.ToTable("CompanyMaster");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BCS.BMC.BMC.FirebaseCloudMessages.FirebaseCloudMessageDetails", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationTime")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatorUserId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long?>("DeleterUserId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DeletionTime")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FcmToken")
|
|
||||||
.HasMaxLength(512)
|
|
||||||
.HasColumnType("nvarchar(512)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModificationTime")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifierUserId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Message")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("MessageSentDateTime")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("SenderImageurl")
|
|
||||||
.HasMaxLength(256)
|
|
||||||
.HasColumnType("nvarchar(256)");
|
|
||||||
|
|
||||||
b.Property<string>("SenderName")
|
|
||||||
.HasMaxLength(32)
|
|
||||||
.HasColumnType("nvarchar(32)");
|
|
||||||
|
|
||||||
b.Property<bool>("Status")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("FirebaseCloudMessageDetails");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("BCS.BMC.BMC.FirebaseCloudMessages.FirebaseToken", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreationTime")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("CreatorUserId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long?>("DeleterUserId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DeletionTime")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<string>("FcmToken")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("HostName")
|
|
||||||
.HasMaxLength(512)
|
|
||||||
.HasColumnType("nvarchar(512)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsDeleted")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("LastModificationTime")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<long?>("LastModifierUserId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<int?>("UserId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("FirebaseToken");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("BCS.BMC.MultiTenancy.Tenant", b =>
|
modelBuilder.Entity("BCS.BMC.MultiTenancy.Tenant", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
@ -29,7 +29,6 @@ using System.Text;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Abp.AutoMapper;
|
using Abp.AutoMapper;
|
||||||
using Abp.Domain.Entities;
|
using Abp.Domain.Entities;
|
||||||
using BCS.BMC.BMC.FirebaseCloudMessages;
|
|
||||||
|
|
||||||
namespace BCS.BMC.Controllers
|
namespace BCS.BMC.Controllers
|
||||||
{
|
{
|
||||||
@ -44,7 +43,6 @@ namespace BCS.BMC.Controllers
|
|||||||
private readonly IExternalAuthManager _externalAuthManager;
|
private readonly IExternalAuthManager _externalAuthManager;
|
||||||
private readonly UserRegistrationManager _userRegistrationManager;
|
private readonly UserRegistrationManager _userRegistrationManager;
|
||||||
private readonly IRepository<CompanyMaster, int> _companyMaster;
|
private readonly IRepository<CompanyMaster, int> _companyMaster;
|
||||||
private readonly IRepository<FirebaseToken, int> _firebaseToken;
|
|
||||||
ResponseMessageModel responsemessage = new ResponseMessageModel();
|
ResponseMessageModel responsemessage = new ResponseMessageModel();
|
||||||
public TokenAuthController(
|
public TokenAuthController(
|
||||||
LogInManager logInManager,
|
LogInManager logInManager,
|
||||||
@ -54,8 +52,7 @@ namespace BCS.BMC.Controllers
|
|||||||
IExternalAuthConfiguration externalAuthConfiguration,
|
IExternalAuthConfiguration externalAuthConfiguration,
|
||||||
IExternalAuthManager externalAuthManager,
|
IExternalAuthManager externalAuthManager,
|
||||||
UserRegistrationManager userRegistrationManager,
|
UserRegistrationManager userRegistrationManager,
|
||||||
IRepository<CompanyMaster, int> companyMaster,
|
IRepository<CompanyMaster, int> companyMaster)
|
||||||
IRepository<FirebaseToken, int> firebaseToken)
|
|
||||||
{
|
{
|
||||||
_logInManager = logInManager;
|
_logInManager = logInManager;
|
||||||
_tenantCache = tenantCache;
|
_tenantCache = tenantCache;
|
||||||
@ -65,7 +62,6 @@ namespace BCS.BMC.Controllers
|
|||||||
_externalAuthManager = externalAuthManager;
|
_externalAuthManager = externalAuthManager;
|
||||||
_userRegistrationManager = userRegistrationManager;
|
_userRegistrationManager = userRegistrationManager;
|
||||||
_companyMaster = companyMaster;
|
_companyMaster = companyMaster;
|
||||||
_firebaseToken = firebaseToken;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -317,24 +313,7 @@ namespace BCS.BMC.Controllers
|
|||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
var responseStream = await response.Content.ReadAsStringAsync();
|
var responseStream = await response.Content.ReadAsStringAsync();
|
||||||
LoginOrRegisterResponseMessageModel result = JsonConvert.DeserializeObject<LoginOrRegisterResponseMessageModel>(responseStream);
|
LoginOrRegisterResponseMessageModel result = JsonConvert.DeserializeObject<LoginOrRegisterResponseMessageModel>(responseStream);
|
||||||
|
|
||||||
|
|
||||||
var getTokenDetails = _firebaseToken.GetAllList().Where(x => x.HostName == host && x.UserId == int.Parse(result.result.userId)).FirstOrDefault();
|
|
||||||
if (getTokenDetails is null)
|
|
||||||
{
|
|
||||||
FirebaseToken entity = new FirebaseToken();
|
|
||||||
entity.UserId = int.Parse(result.result.userId);
|
|
||||||
entity.HostName = host;
|
|
||||||
entity.FcmToken = input.FcmToken;
|
|
||||||
await _firebaseToken.InsertAndGetIdAsync(entity);
|
|
||||||
}
|
|
||||||
if (getTokenDetails != null)
|
|
||||||
{
|
|
||||||
FirebaseToken entity = new FirebaseToken();
|
|
||||||
getTokenDetails.FcmToken = input.FcmToken;
|
|
||||||
await _firebaseToken.UpdateAsync(getTokenDetails);
|
|
||||||
}
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
else if (response.StatusCode == HttpStatusCode.InternalServerError)
|
else if (response.StatusCode == HttpStatusCode.InternalServerError)
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BCS.BMC.BMC.CompanyMasters;
|
|
||||||
using Abp.AutoMapper;
|
|
||||||
using BCS.BMC.BMC.FirebaseCloudMessages;
|
|
||||||
|
|
||||||
namespace BCS.BMC.Models.TokenAuth
|
|
||||||
{
|
|
||||||
|
|
||||||
[AutoMap(typeof(FirebaseToken))]
|
|
||||||
public class CreateOrUpdateFireBaseModel
|
|
||||||
{
|
|
||||||
public int? UserId { get; set; }
|
|
||||||
public string HostName { get; set; }
|
|
||||||
public string FcmToken { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user