Added the data for company types and units and Added the get APIs for this masters

This commit is contained in:
ashutosh.nehete 2025-10-30 11:58:16 +05:30
parent 7e90e4a703
commit 25896d3093
9 changed files with 11427 additions and 3 deletions

View File

@ -158,6 +158,7 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<RequisitionStatusEmployeeMapping> RequisitionStatusEmployeeMappings { get; set; } public DbSet<RequisitionStatusEmployeeMapping> RequisitionStatusEmployeeMappings { get; set; }
public DbSet<RequisitionStatusLogs> RequisitionStatusLogs { get; set; } public DbSet<RequisitionStatusLogs> RequisitionStatusLogs { get; set; }
public DbSet<RequisitionStatusMapping> RequisitionStatusMappings { get; set; } public DbSet<RequisitionStatusMapping> RequisitionStatusMappings { get; set; }
public DbSet<CompanyTypeMaster> CompanyTypeMasters { get; set; }
public DbSet<Supplier> Suppliers { get; set; } public DbSet<Supplier> Suppliers { get; set; }
public DbSet<SupplierStateMapping> SupplierStateMappings { get; set; } public DbSet<SupplierStateMapping> SupplierStateMappings { get; set; }
public DbSet<Manufacturer> Manufacturers { get; set; } public DbSet<Manufacturer> Manufacturers { get; set; }
@ -1098,6 +1099,149 @@ namespace Marco.Pms.DataAccess.Data
} }
); );
modelBuilder.Entity<UnitType>().HasData(
new UnitType
{
Id = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea"),
Name = "Length",
Description = "Measures the extent of an object or distance between two points in space."
},
new UnitType
{
Id = Guid.Parse("d47a54aa-de46-4aec-9bd6-276b046d35ac"),
Name = "Mass",
Description = "Represents the amount of matter in an object."
},
new UnitType
{
Id = Guid.Parse("7ef849c0-0979-4a6c-87ad-9aefb8675679"),
Name = "Time",
Description = "Measures the duration or interval between events."
},
new UnitType
{
Id = Guid.Parse("2ecfd89f-8c90-4664-a72e-911b7ad29646"),
Name = "Electric Current",
Description = "Measures the flow of electric charge."
},
new UnitType
{
Id = Guid.Parse("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3"),
Name = "Thermodynamic Temperature",
Description = "Measures the heat or thermal energy level of a system."
},
new UnitType
{
Id = Guid.Parse("b1c4b844-1b85-4601-a575-4992c47533ac"),
Name = "Amount of Substance",
Description = "Counts the number of elementary entities(atoms, molecules, etc.) in a sample."
},
new UnitType
{
Id = Guid.Parse("abc1b8cc-fcaf-4e45-8b72-e47036166fbc"),
Name = "Luminous Intensity",
Description = "Measures the perceived brightness of light emitted from a source."
},
new UnitType
{
Id = Guid.Parse("d1300314-3db6-48c6-b5d2-5542d30d18ea"),
Name = "Area",
Description = "Measures the size of a surface."
},
new UnitType
{
Id = Guid.Parse("806e3b0a-306e-427e-8206-610c1c618cd8"),
Name = "Speed",
Description = "Measures how fast an object moves, i.e., distance traveled per unit time."
},
new UnitType
{
Id = Guid.Parse("52733b8a-04bc-4eb7-bade-9f7869283473"),
Name = "Volume",
Description = "Measures the three - dimensional space occupied by a substance or object."
}
);
modelBuilder.Entity<TechnicalUnit>().HasData(
// Length
new TechnicalUnit { Id = Guid.Parse("fae4dd36-e9eb-49a4-bcaa-9e723fd43069"), Name = "Meter", Description = "SI base unit of length", UnitTypeId = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea") },
new TechnicalUnit { Id = Guid.Parse("131b4588-aba2-479c-a1e5-0ad461f16329"), Name = "Kilometer", Description = "1000 meters; commonly used for large distances", UnitTypeId = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea") },
new TechnicalUnit { Id = Guid.Parse("9f758559-e5a0-40b9-a21f-f9bd5ddd1e9b"), Name = "Centimeter", Description = "0.01 meter; used for small lengths", UnitTypeId = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea") },
new TechnicalUnit { Id = Guid.Parse("8ce98c62-83f3-4a45-afb0-32d4e3edfb9c"), Name = "Millimeter", Description = "0.001 meter; for very small lengths", UnitTypeId = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea") },
new TechnicalUnit { Id = Guid.Parse("2e7d1cad-4c26-408c-9b70-dd0dc0dcc145"), Name = "Inch", Description = "Non-SI unit; equal to 0.0254 meters", UnitTypeId = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea") },
new TechnicalUnit { Id = Guid.Parse("088630c5-6866-49ea-afab-cb6c0d3d0ebb"), Name = "Foot", Description = "Non-SI unit; equal to 0.3048 meters", UnitTypeId = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea") },
new TechnicalUnit { Id = Guid.Parse("4769e008-5e0c-4b60-b434-b23060966d54"), Name = "Mile", Description = "Non-SI unit; equal to 1609.34 meters", UnitTypeId = Guid.Parse("21dc7d85-1018-479f-8e4a-3b52294903ea") },
// Mass
new TechnicalUnit { Id = Guid.Parse("8392eab5-7b8c-4785-873b-81072566b876"), Name = "Kilogram", Description = "SI base unit of mass", UnitTypeId = Guid.Parse("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
new TechnicalUnit { Id = Guid.Parse("6df17071-6506-46dc-bd81-326391941dfa"), Name = "Gram", Description = "0.001 kilogram", UnitTypeId = Guid.Parse("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
new TechnicalUnit { Id = Guid.Parse("26f6a207-5c8a-43a5-91f3-33eb1f46227f"), Name = "Milligram", Description = "0.000001 kilogram", UnitTypeId = Guid.Parse("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
new TechnicalUnit { Id = Guid.Parse("356a2536-5b0b-4128-baaa-306245068d3c"), Name = "Metric ton", Description = "1000 kilograms", UnitTypeId = Guid.Parse("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
new TechnicalUnit { Id = Guid.Parse("e0009850-0d6a-4ed0-bf9b-daf1354869f7"), Name = "Pound", Description = "Non-SI unit; equal to 0.453592 kilograms", UnitTypeId = Guid.Parse("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
// Time
new TechnicalUnit { Id = Guid.Parse("8ca66275-772e-43c3-bb7b-6b68af4b1839"), Name = "Second", Description = "SI base unit of time", UnitTypeId = Guid.Parse("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
new TechnicalUnit { Id = Guid.Parse("4752422b-4b9b-4fca-9d78-3a372c0a8e7c"), Name = "Millisecond", Description = "0.001 second", UnitTypeId = Guid.Parse("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
new TechnicalUnit { Id = Guid.Parse("93a97a4d-603d-4c00-a516-f3170656f0b2"), Name = "Minute", Description = "60 seconds", UnitTypeId = Guid.Parse("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
new TechnicalUnit { Id = Guid.Parse("94eea97c-8853-414c-b7a9-4b05b483353d"), Name = "Hour", Description = "3600 seconds", UnitTypeId = Guid.Parse("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
// Electric Current
new TechnicalUnit { Id = Guid.Parse("53f3a4ca-f44b-481c-92ab-a9cd49649243"), Name = "Ampere", Description = "SI base unit of electric current", UnitTypeId = Guid.Parse("2ecfd89f-8c90-4664-a72e-911b7ad29646") },
new TechnicalUnit { Id = Guid.Parse("45dd0601-dc09-4922-9153-ec76431ef0c5"), Name = "Milliampere", Description = "0.001 ampere", UnitTypeId = Guid.Parse("2ecfd89f-8c90-4664-a72e-911b7ad29646") },
// Thermodynamic Temperature
new TechnicalUnit { Id = Guid.Parse("0dd0fa51-36bf-4083-a7b1-901f7a3fe234"), Name = "Kelvin", Description = "SI base unit of temperature", UnitTypeId = Guid.Parse("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3") },
new TechnicalUnit { Id = Guid.Parse("18e72164-8ead-45a0-9291-a5179e059c0c"), Name = "Degree Celsius", Description = "Scale for measuring temperature; 0°C = 273.15 K", UnitTypeId = Guid.Parse("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3") },
// Amount of Substance
new TechnicalUnit { Id = Guid.Parse("723496bc-500b-4938-8f25-48472446c6e9"), Name = "Mole", Description = "SI base unit of amount of substance", UnitTypeId = Guid.Parse("b1c4b844-1b85-4601-a575-4992c47533ac") },
// Luminous Intensity
new TechnicalUnit { Id = Guid.Parse("9e830840-c1f1-4dfc-aaef-74a1f464c798"), Name = "Candela", Description = "SI base unit of luminous intensity", UnitTypeId = Guid.Parse("abc1b8cc-fcaf-4e45-8b72-e47036166fbc") },
// Area
new TechnicalUnit { Id = Guid.Parse("15f4422e-b861-45f6-84e4-c1932b7df119"), Name = "Square meter", Description = "SI derived unit of area", UnitTypeId = Guid.Parse("d1300314-3db6-48c6-b5d2-5542d30d18ea") },
new TechnicalUnit { Id = Guid.Parse("7bc508a0-c5d1-497e-859c-6a617613d9a6"), Name = "Hectare", Description = "10,000 square meters; used for land area", UnitTypeId = Guid.Parse("d1300314-3db6-48c6-b5d2-5542d30d18ea") },
new TechnicalUnit { Id = Guid.Parse("f968eb00-c9b3-483b-ba4b-3ed8ee89de17"), Name = "Square kilometer", Description = "1,000,000 square meters", UnitTypeId = Guid.Parse("d1300314-3db6-48c6-b5d2-5542d30d18ea") },
// Speed
new TechnicalUnit { Id = Guid.Parse("151c7344-7b70-4bea-a04f-39b6f5b43ce0"), Name = "Meter per second", Description = "SI derived unit for speed/velocity", UnitTypeId = Guid.Parse("806e3b0a-306e-427e-8206-610c1c618cd8") },
new TechnicalUnit { Id = Guid.Parse("78b9db6d-5bca-4d87-9d98-7a70fcc400f7"), Name = "Kilometer per hour", Description = "Common unit of speed; 1 km/h = 0.27778 m/s", UnitTypeId = Guid.Parse("806e3b0a-306e-427e-8206-610c1c618cd8") },
// Volume
new TechnicalUnit { Id = Guid.Parse("98c8f101-310b-450e-b502-4cf61d9cde1a"), Name = "Cubic meter", Description = "SI derived unit of volume", UnitTypeId = Guid.Parse("52733b8a-04bc-4eb7-bade-9f7869283473") },
new TechnicalUnit { Id = Guid.Parse("36c29f6f-70dc-4ca6-bd1e-64b578de0a0f"), Name = "Liter", Description = "0.001 cubic meter; commonly used for liquids", UnitTypeId = Guid.Parse("52733b8a-04bc-4eb7-bade-9f7869283473") },
new TechnicalUnit { Id = Guid.Parse("b1aab8fe-2d78-4e65-974a-bc09a22446ee"), Name = "Milliliter", Description = "0.000001 cubic meter or 0.001 liter", UnitTypeId = Guid.Parse("52733b8a-04bc-4eb7-bade-9f7869283473") }
);
modelBuilder.Entity<CompanyTypeMaster>().HasData(
new CompanyTypeMaster
{
Id = Guid.Parse("04f543cb-6797-41bf-bfd8-e3c399c9c071"),
Name = "Public Limited",
Description = "Company whose shares are traded publicly"
},
new CompanyTypeMaster
{
Id = Guid.Parse("ea0d374a-e149-4296-9f45-eb36b39047d6"),
Name = "Private Limited",
Description = "Privately held company with limited liability"
},
new CompanyTypeMaster
{
Id = Guid.Parse("f9426132-8bc9-440d-bd4f-a9f2bc7f395a"),
Name = "Partnership",
Description = "Business owned by two or more partners"
},
new CompanyTypeMaster
{
Id = Guid.Parse("8703932e-ca8d-4ab9-876b-7c313133356d"),
Name = "Sole Proprietorship",
Description = "Owned and run by one individual"
}
);
modelBuilder.Entity<CountryMaster>().HasData( modelBuilder.Entity<CountryMaster>().HasData(
new CountryMaster { Id = Guid.Parse("b9fd9cf6-12df-498d-b087-ab8bf8bd47ed"), Name = "Afghanistan", CountryCode = "AF", CurrencyCode = "AFN", PhoneCode = "+93" }, new CountryMaster { Id = Guid.Parse("b9fd9cf6-12df-498d-b087-ab8bf8bd47ed"), Name = "Afghanistan", CountryCode = "AF", CurrencyCode = "AFN", PhoneCode = "+93" },
new CountryMaster { Id = Guid.Parse("8fd97292-4f21-48fc-a8a4-4eb57e851b07"), Name = "Albania", CountryCode = "AL", CurrencyCode = "ALL", PhoneCode = "+355" }, new CountryMaster { Id = Guid.Parse("8fd97292-4f21-48fc-a8a4-4eb57e851b07"), Name = "Albania", CountryCode = "AL", CurrencyCode = "ALL", PhoneCode = "+355" },

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,304 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Added_Data_In_Units_And_CompanyTypeMaster_Table : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CompanyTypeMasters",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_CompanyTypeMasters", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "CompanyTypeMasters",
columns: new[] { "Id", "Description", "Name" },
values: new object[,]
{
{ new Guid("04f543cb-6797-41bf-bfd8-e3c399c9c071"), "Company whose shares are traded publicly", "Public Limited" },
{ new Guid("8703932e-ca8d-4ab9-876b-7c313133356d"), "Owned and run by one individual", "Sole Proprietorship" },
{ new Guid("ea0d374a-e149-4296-9f45-eb36b39047d6"), "Privately held company with limited liability", "Private Limited" },
{ new Guid("f9426132-8bc9-440d-bd4f-a9f2bc7f395a"), "Business owned by two or more partners", "Partnership" }
});
migrationBuilder.InsertData(
table: "UnitTypes",
columns: new[] { "Id", "Description", "Name" },
values: new object[,]
{
{ new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea"), "Measures the extent of an object or distance between two points in space.", "Length" },
{ new Guid("2ecfd89f-8c90-4664-a72e-911b7ad29646"), "Measures the flow of electric charge.", "Electric Current" },
{ new Guid("52733b8a-04bc-4eb7-bade-9f7869283473"), "Measures the three - dimensional space occupied by a substance or object.", "Volume" },
{ new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679"), "Measures the duration or interval between events.", "Time" },
{ new Guid("806e3b0a-306e-427e-8206-610c1c618cd8"), "Measures how fast an object moves, i.e., distance traveled per unit time.", "Speed" },
{ new Guid("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3"), "Measures the heat or thermal energy level of a system.", "Thermodynamic Temperature" },
{ new Guid("abc1b8cc-fcaf-4e45-8b72-e47036166fbc"), "Measures the perceived brightness of light emitted from a source.", "Luminous Intensity" },
{ new Guid("b1c4b844-1b85-4601-a575-4992c47533ac"), "Counts the number of elementary entities(atoms, molecules, etc.) in a sample.", "Amount of Substance" },
{ new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea"), "Measures the size of a surface.", "Area" },
{ new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac"), "Represents the amount of matter in an object.", "Mass" }
});
migrationBuilder.InsertData(
table: "TechnicalUnits",
columns: new[] { "Id", "Description", "Name", "UnitTypeId" },
values: new object[,]
{
{ new Guid("088630c5-6866-49ea-afab-cb6c0d3d0ebb"), "Non-SI unit; equal to 0.3048 meters", "Foot", new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea") },
{ new Guid("0dd0fa51-36bf-4083-a7b1-901f7a3fe234"), "SI base unit of temperature", "Kelvin", new Guid("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3") },
{ new Guid("131b4588-aba2-479c-a1e5-0ad461f16329"), "1000 meters; commonly used for large distances", "Kilometer", new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea") },
{ new Guid("151c7344-7b70-4bea-a04f-39b6f5b43ce0"), "SI derived unit for speed/velocity", "Meter per second", new Guid("806e3b0a-306e-427e-8206-610c1c618cd8") },
{ new Guid("15f4422e-b861-45f6-84e4-c1932b7df119"), "SI derived unit of area", "Square meter", new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea") },
{ new Guid("18e72164-8ead-45a0-9291-a5179e059c0c"), "Scale for measuring temperature; 0°C = 273.15 K", "Degree Celsius", new Guid("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3") },
{ new Guid("26f6a207-5c8a-43a5-91f3-33eb1f46227f"), "0.000001 kilogram", "Milligram", new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
{ new Guid("2e7d1cad-4c26-408c-9b70-dd0dc0dcc145"), "Non-SI unit; equal to 0.0254 meters", "Inch", new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea") },
{ new Guid("356a2536-5b0b-4128-baaa-306245068d3c"), "1000 kilograms", "Metric ton", new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
{ new Guid("36c29f6f-70dc-4ca6-bd1e-64b578de0a0f"), "0.001 cubic meter; commonly used for liquids", "Liter", new Guid("52733b8a-04bc-4eb7-bade-9f7869283473") },
{ new Guid("45dd0601-dc09-4922-9153-ec76431ef0c5"), "0.001 ampere", "Milliampere", new Guid("2ecfd89f-8c90-4664-a72e-911b7ad29646") },
{ new Guid("4752422b-4b9b-4fca-9d78-3a372c0a8e7c"), "0.001 second", "Millisecond", new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
{ new Guid("4769e008-5e0c-4b60-b434-b23060966d54"), "Non-SI unit; equal to 1609.34 meters", "Mile", new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea") },
{ new Guid("53f3a4ca-f44b-481c-92ab-a9cd49649243"), "SI base unit of electric current", "Ampere", new Guid("2ecfd89f-8c90-4664-a72e-911b7ad29646") },
{ new Guid("6df17071-6506-46dc-bd81-326391941dfa"), "0.001 kilogram", "Gram", new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
{ new Guid("723496bc-500b-4938-8f25-48472446c6e9"), "SI base unit of amount of substance", "Mole", new Guid("b1c4b844-1b85-4601-a575-4992c47533ac") },
{ new Guid("78b9db6d-5bca-4d87-9d98-7a70fcc400f7"), "Common unit of speed; 1 km/h = 0.27778 m/s", "Kilometer per hour", new Guid("806e3b0a-306e-427e-8206-610c1c618cd8") },
{ new Guid("7bc508a0-c5d1-497e-859c-6a617613d9a6"), "10,000 square meters; used for land area", "Hectare", new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea") },
{ new Guid("8392eab5-7b8c-4785-873b-81072566b876"), "SI base unit of mass", "Kilogram", new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
{ new Guid("8ca66275-772e-43c3-bb7b-6b68af4b1839"), "SI base unit of time", "Second", new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
{ new Guid("8ce98c62-83f3-4a45-afb0-32d4e3edfb9c"), "0.001 meter; for very small lengths", "Millimeter", new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea") },
{ new Guid("93a97a4d-603d-4c00-a516-f3170656f0b2"), "60 seconds", "Minute", new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
{ new Guid("94eea97c-8853-414c-b7a9-4b05b483353d"), "3600 seconds", "Hour", new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679") },
{ new Guid("98c8f101-310b-450e-b502-4cf61d9cde1a"), "SI derived unit of volume", "Cubic meter", new Guid("52733b8a-04bc-4eb7-bade-9f7869283473") },
{ new Guid("9e830840-c1f1-4dfc-aaef-74a1f464c798"), "SI base unit of luminous intensity", "Candela", new Guid("abc1b8cc-fcaf-4e45-8b72-e47036166fbc") },
{ new Guid("9f758559-e5a0-40b9-a21f-f9bd5ddd1e9b"), "0.01 meter; used for small lengths", "Centimeter", new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea") },
{ new Guid("b1aab8fe-2d78-4e65-974a-bc09a22446ee"), "0.000001 cubic meter or 0.001 liter", "Milliliter", new Guid("52733b8a-04bc-4eb7-bade-9f7869283473") },
{ new Guid("e0009850-0d6a-4ed0-bf9b-daf1354869f7"), "Non-SI unit; equal to 0.453592 kilograms", "Pound", new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac") },
{ new Guid("f968eb00-c9b3-483b-ba4b-3ed8ee89de17"), "1,000,000 square meters", "Square kilometer", new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea") },
{ new Guid("fae4dd36-e9eb-49a4-bcaa-9e723fd43069"), "SI base unit of length", "Meter", new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea") }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CompanyTypeMasters");
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("088630c5-6866-49ea-afab-cb6c0d3d0ebb"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("0dd0fa51-36bf-4083-a7b1-901f7a3fe234"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("131b4588-aba2-479c-a1e5-0ad461f16329"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("151c7344-7b70-4bea-a04f-39b6f5b43ce0"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("15f4422e-b861-45f6-84e4-c1932b7df119"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("18e72164-8ead-45a0-9291-a5179e059c0c"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("26f6a207-5c8a-43a5-91f3-33eb1f46227f"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("2e7d1cad-4c26-408c-9b70-dd0dc0dcc145"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("356a2536-5b0b-4128-baaa-306245068d3c"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("36c29f6f-70dc-4ca6-bd1e-64b578de0a0f"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("45dd0601-dc09-4922-9153-ec76431ef0c5"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("4752422b-4b9b-4fca-9d78-3a372c0a8e7c"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("4769e008-5e0c-4b60-b434-b23060966d54"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("53f3a4ca-f44b-481c-92ab-a9cd49649243"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("6df17071-6506-46dc-bd81-326391941dfa"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("723496bc-500b-4938-8f25-48472446c6e9"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("78b9db6d-5bca-4d87-9d98-7a70fcc400f7"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("7bc508a0-c5d1-497e-859c-6a617613d9a6"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("8392eab5-7b8c-4785-873b-81072566b876"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("8ca66275-772e-43c3-bb7b-6b68af4b1839"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("8ce98c62-83f3-4a45-afb0-32d4e3edfb9c"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("93a97a4d-603d-4c00-a516-f3170656f0b2"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("94eea97c-8853-414c-b7a9-4b05b483353d"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("98c8f101-310b-450e-b502-4cf61d9cde1a"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("9e830840-c1f1-4dfc-aaef-74a1f464c798"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("9f758559-e5a0-40b9-a21f-f9bd5ddd1e9b"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("b1aab8fe-2d78-4e65-974a-bc09a22446ee"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("e0009850-0d6a-4ed0-bf9b-daf1354869f7"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("f968eb00-c9b3-483b-ba4b-3ed8ee89de17"));
migrationBuilder.DeleteData(
table: "TechnicalUnits",
keyColumn: "Id",
keyValue: new Guid("fae4dd36-e9eb-49a4-bcaa-9e723fd43069"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("2ecfd89f-8c90-4664-a72e-911b7ad29646"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("52733b8a-04bc-4eb7-bade-9f7869283473"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("806e3b0a-306e-427e-8206-610c1c618cd8"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("abc1b8cc-fcaf-4e45-8b72-e47036166fbc"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("b1c4b844-1b85-4601-a575-4992c47533ac"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea"));
migrationBuilder.DeleteData(
table: "UnitTypes",
keyColumn: "Id",
keyValue: new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac"));
}
}
}

View File

@ -3478,6 +3478,51 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("ActivityMasters"); b.ToTable("ActivityMasters");
}); });
modelBuilder.Entity("Marco.Pms.Model.Master.CompanyTypeMaster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("CompanyTypeMasters");
b.HasData(
new
{
Id = new Guid("04f543cb-6797-41bf-bfd8-e3c399c9c071"),
Description = "Company whose shares are traded publicly",
Name = "Public Limited"
},
new
{
Id = new Guid("ea0d374a-e149-4296-9f45-eb36b39047d6"),
Description = "Privately held company with limited liability",
Name = "Private Limited"
},
new
{
Id = new Guid("f9426132-8bc9-440d-bd4f-a9f2bc7f395a"),
Description = "Business owned by two or more partners",
Name = "Partnership"
},
new
{
Id = new Guid("8703932e-ca8d-4ab9-876b-7c313133356d"),
Description = "Owned and run by one individual",
Name = "Sole Proprietorship"
});
});
modelBuilder.Entity("Marco.Pms.Model.Master.CountryMaster", b => modelBuilder.Entity("Marco.Pms.Model.Master.CountryMaster", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -6511,6 +6556,218 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasIndex("UnitTypeId"); b.HasIndex("UnitTypeId");
b.ToTable("TechnicalUnits"); b.ToTable("TechnicalUnits");
b.HasData(
new
{
Id = new Guid("fae4dd36-e9eb-49a4-bcaa-9e723fd43069"),
Description = "SI base unit of length",
Name = "Meter",
UnitTypeId = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea")
},
new
{
Id = new Guid("131b4588-aba2-479c-a1e5-0ad461f16329"),
Description = "1000 meters; commonly used for large distances",
Name = "Kilometer",
UnitTypeId = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea")
},
new
{
Id = new Guid("9f758559-e5a0-40b9-a21f-f9bd5ddd1e9b"),
Description = "0.01 meter; used for small lengths",
Name = "Centimeter",
UnitTypeId = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea")
},
new
{
Id = new Guid("8ce98c62-83f3-4a45-afb0-32d4e3edfb9c"),
Description = "0.001 meter; for very small lengths",
Name = "Millimeter",
UnitTypeId = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea")
},
new
{
Id = new Guid("2e7d1cad-4c26-408c-9b70-dd0dc0dcc145"),
Description = "Non-SI unit; equal to 0.0254 meters",
Name = "Inch",
UnitTypeId = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea")
},
new
{
Id = new Guid("088630c5-6866-49ea-afab-cb6c0d3d0ebb"),
Description = "Non-SI unit; equal to 0.3048 meters",
Name = "Foot",
UnitTypeId = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea")
},
new
{
Id = new Guid("4769e008-5e0c-4b60-b434-b23060966d54"),
Description = "Non-SI unit; equal to 1609.34 meters",
Name = "Mile",
UnitTypeId = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea")
},
new
{
Id = new Guid("8392eab5-7b8c-4785-873b-81072566b876"),
Description = "SI base unit of mass",
Name = "Kilogram",
UnitTypeId = new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac")
},
new
{
Id = new Guid("6df17071-6506-46dc-bd81-326391941dfa"),
Description = "0.001 kilogram",
Name = "Gram",
UnitTypeId = new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac")
},
new
{
Id = new Guid("26f6a207-5c8a-43a5-91f3-33eb1f46227f"),
Description = "0.000001 kilogram",
Name = "Milligram",
UnitTypeId = new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac")
},
new
{
Id = new Guid("356a2536-5b0b-4128-baaa-306245068d3c"),
Description = "1000 kilograms",
Name = "Metric ton",
UnitTypeId = new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac")
},
new
{
Id = new Guid("e0009850-0d6a-4ed0-bf9b-daf1354869f7"),
Description = "Non-SI unit; equal to 0.453592 kilograms",
Name = "Pound",
UnitTypeId = new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac")
},
new
{
Id = new Guid("8ca66275-772e-43c3-bb7b-6b68af4b1839"),
Description = "SI base unit of time",
Name = "Second",
UnitTypeId = new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679")
},
new
{
Id = new Guid("4752422b-4b9b-4fca-9d78-3a372c0a8e7c"),
Description = "0.001 second",
Name = "Millisecond",
UnitTypeId = new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679")
},
new
{
Id = new Guid("93a97a4d-603d-4c00-a516-f3170656f0b2"),
Description = "60 seconds",
Name = "Minute",
UnitTypeId = new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679")
},
new
{
Id = new Guid("94eea97c-8853-414c-b7a9-4b05b483353d"),
Description = "3600 seconds",
Name = "Hour",
UnitTypeId = new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679")
},
new
{
Id = new Guid("53f3a4ca-f44b-481c-92ab-a9cd49649243"),
Description = "SI base unit of electric current",
Name = "Ampere",
UnitTypeId = new Guid("2ecfd89f-8c90-4664-a72e-911b7ad29646")
},
new
{
Id = new Guid("45dd0601-dc09-4922-9153-ec76431ef0c5"),
Description = "0.001 ampere",
Name = "Milliampere",
UnitTypeId = new Guid("2ecfd89f-8c90-4664-a72e-911b7ad29646")
},
new
{
Id = new Guid("0dd0fa51-36bf-4083-a7b1-901f7a3fe234"),
Description = "SI base unit of temperature",
Name = "Kelvin",
UnitTypeId = new Guid("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3")
},
new
{
Id = new Guid("18e72164-8ead-45a0-9291-a5179e059c0c"),
Description = "Scale for measuring temperature; 0°C = 273.15 K",
Name = "Degree Celsius",
UnitTypeId = new Guid("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3")
},
new
{
Id = new Guid("723496bc-500b-4938-8f25-48472446c6e9"),
Description = "SI base unit of amount of substance",
Name = "Mole",
UnitTypeId = new Guid("b1c4b844-1b85-4601-a575-4992c47533ac")
},
new
{
Id = new Guid("9e830840-c1f1-4dfc-aaef-74a1f464c798"),
Description = "SI base unit of luminous intensity",
Name = "Candela",
UnitTypeId = new Guid("abc1b8cc-fcaf-4e45-8b72-e47036166fbc")
},
new
{
Id = new Guid("15f4422e-b861-45f6-84e4-c1932b7df119"),
Description = "SI derived unit of area",
Name = "Square meter",
UnitTypeId = new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea")
},
new
{
Id = new Guid("7bc508a0-c5d1-497e-859c-6a617613d9a6"),
Description = "10,000 square meters; used for land area",
Name = "Hectare",
UnitTypeId = new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea")
},
new
{
Id = new Guid("f968eb00-c9b3-483b-ba4b-3ed8ee89de17"),
Description = "1,000,000 square meters",
Name = "Square kilometer",
UnitTypeId = new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea")
},
new
{
Id = new Guid("151c7344-7b70-4bea-a04f-39b6f5b43ce0"),
Description = "SI derived unit for speed/velocity",
Name = "Meter per second",
UnitTypeId = new Guid("806e3b0a-306e-427e-8206-610c1c618cd8")
},
new
{
Id = new Guid("78b9db6d-5bca-4d87-9d98-7a70fcc400f7"),
Description = "Common unit of speed; 1 km/h = 0.27778 m/s",
Name = "Kilometer per hour",
UnitTypeId = new Guid("806e3b0a-306e-427e-8206-610c1c618cd8")
},
new
{
Id = new Guid("98c8f101-310b-450e-b502-4cf61d9cde1a"),
Description = "SI derived unit of volume",
Name = "Cubic meter",
UnitTypeId = new Guid("52733b8a-04bc-4eb7-bade-9f7869283473")
},
new
{
Id = new Guid("36c29f6f-70dc-4ca6-bd1e-64b578de0a0f"),
Description = "0.001 cubic meter; commonly used for liquids",
Name = "Liter",
UnitTypeId = new Guid("52733b8a-04bc-4eb7-bade-9f7869283473")
},
new
{
Id = new Guid("b1aab8fe-2d78-4e65-974a-bc09a22446ee"),
Description = "0.000001 cubic meter or 0.001 liter",
Name = "Milliliter",
UnitTypeId = new Guid("52733b8a-04bc-4eb7-bade-9f7869283473")
});
}); });
modelBuilder.Entity("Marco.Pms.Model.Master.TenantStatus", b => modelBuilder.Entity("Marco.Pms.Model.Master.TenantStatus", b =>
@ -6752,6 +7009,68 @@ namespace Marco.Pms.DataAccess.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("UnitTypes"); b.ToTable("UnitTypes");
b.HasData(
new
{
Id = new Guid("21dc7d85-1018-479f-8e4a-3b52294903ea"),
Description = "Measures the extent of an object or distance between two points in space.",
Name = "Length"
},
new
{
Id = new Guid("d47a54aa-de46-4aec-9bd6-276b046d35ac"),
Description = "Represents the amount of matter in an object.",
Name = "Mass"
},
new
{
Id = new Guid("7ef849c0-0979-4a6c-87ad-9aefb8675679"),
Description = "Measures the duration or interval between events.",
Name = "Time"
},
new
{
Id = new Guid("2ecfd89f-8c90-4664-a72e-911b7ad29646"),
Description = "Measures the flow of electric charge.",
Name = "Electric Current"
},
new
{
Id = new Guid("a0dd396c-943a-49cd-87e9-24e1fc9cf1b3"),
Description = "Measures the heat or thermal energy level of a system.",
Name = "Thermodynamic Temperature"
},
new
{
Id = new Guid("b1c4b844-1b85-4601-a575-4992c47533ac"),
Description = "Counts the number of elementary entities(atoms, molecules, etc.) in a sample.",
Name = "Amount of Substance"
},
new
{
Id = new Guid("abc1b8cc-fcaf-4e45-8b72-e47036166fbc"),
Description = "Measures the perceived brightness of light emitted from a source.",
Name = "Luminous Intensity"
},
new
{
Id = new Guid("d1300314-3db6-48c6-b5d2-5542d30d18ea"),
Description = "Measures the size of a surface.",
Name = "Area"
},
new
{
Id = new Guid("806e3b0a-306e-427e-8206-610c1c618cd8"),
Description = "Measures how fast an object moves, i.e., distance traveled per unit time.",
Name = "Speed"
},
new
{
Id = new Guid("52733b8a-04bc-4eb7-bade-9f7869283473"),
Description = "Measures the three - dimensional space occupied by a substance or object.",
Name = "Volume"
});
}); });
modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b =>

View File

@ -0,0 +1,9 @@
namespace Marco.Pms.Model.Master
{
public class CompanyTypeMaster
{
public Guid Id { get; set; }
public string Name { get; set; } = default!;
public string Description { get; set; } = default!;
}
}

View File

@ -62,6 +62,42 @@ namespace Marco.Pms.Services.Controllers
#endregion #endregion
#region =================================================================== Unit Type APIs ===================================================================
[HttpGet("unit-type/list")]
public async Task<IActionResult> GetUnitTypes()
{
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
var response = await _masterService.GetUnitTypesAsync(loggedInEmployee, tenantId);
return StatusCode(response.StatusCode, response);
}
#endregion
#region =================================================================== Technical Unit APIs ===================================================================
[HttpGet("technical-unit/list")]
public async Task<IActionResult> GetTechnicalUnit([FromQuery] Guid? unitTypeId)
{
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
var response = await _masterService.GetTechnicalUnitAsync(unitTypeId, loggedInEmployee, tenantId);
return StatusCode(response.StatusCode, response);
}
#endregion
#region =================================================================== Company Type APIs ===================================================================
[HttpGet("company-type/list")]
public async Task<IActionResult> GetCompanyTypes()
{
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
var response = await _masterService.GetCompanyTypesAsync(loggedInEmployee, tenantId);
return StatusCode(response.StatusCode, response);
}
#endregion
#region =================================================================== Organization Type APIs =================================================================== #region =================================================================== Organization Type APIs ===================================================================
[HttpGet("organization-type/list")] [HttpGet("organization-type/list")]

View File

@ -86,10 +86,10 @@ string? connString = builder.Configuration.GetConnectionString("DefaultConnectio
// This single call correctly registers BOTH the DbContext (scoped) AND the IDbContextFactory (singleton). // This single call correctly registers BOTH the DbContext (scoped) AND the IDbContextFactory (singleton).
builder.Services.AddDbContextFactory<ApplicationDbContext>(options => builder.Services.AddDbContextFactory<ApplicationDbContext>(options =>
options.UseMySql(connString, ServerVersion.AutoDetect(connString)).EnableSensitiveDataLogging()); options.UseMySql(connString, ServerVersion.AutoDetect(connString)));
builder.Services.AddDbContext<ApplicationDbContext>(options => builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseMySql(connString, ServerVersion.AutoDetect(connString)).EnableSensitiveDataLogging()); options.UseMySql(connString, ServerVersion.AutoDetect(connString)));
builder.Services.AddIdentity<ApplicationUser, IdentityRole>() builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>() .AddEntityFrameworkStores<ApplicationDbContext>()

View File

@ -121,6 +121,83 @@ namespace Marco.Pms.Services.Service
#endregion #endregion
#region =================================================================== Unit Type APIs ===================================================================
public async Task<ApiResponse<object>> GetUnitTypesAsync(Employee loggedInEmployee, Guid tenantId)
{
_logger.LogDebug("GetUnitTypes called");
try
{
// Step 1: Fetch unit types
var unitTypes = await _context.UnitTypes.OrderBy(ut => ut.Name).ToListAsync();
_logger.LogInfo("Fetched {Count} unit type records for tenantId: {TenantId}", unitTypes.Count, tenantId);
return ApiResponse<object>.SuccessResponse(unitTypes, $"{unitTypes.Count} record(s) of unit type fetched successfully", 200);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error fetching unit type");
return ApiResponse<object>.ErrorResponse("An error occurred while fetching unit type", ex.Message, 500);
}
}
#endregion
#region =================================================================== Technical Unit APIs ===================================================================
public async Task<ApiResponse<object>> GetTechnicalUnitAsync(Guid? unitTypeId, Employee loggedInEmployee, Guid tenantId)
{
_logger.LogDebug("GetTechnicalUnit called");
try
{
// Step 1: Fetch technical unit
var technicalUnitQuery = _context.TechnicalUnits.Include(tu => tu.UnitType).Where(tu => tu.UnitType != null);
if (unitTypeId.HasValue)
{
technicalUnitQuery = technicalUnitQuery.Where(tu => tu.UnitTypeId == unitTypeId.Value);
}
var technicalUnit = await technicalUnitQuery.OrderBy(tu => tu.Name).ToListAsync();
_logger.LogInfo("Fetched {Count} technical unit records for tenantId: {TenantId}", technicalUnit.Count, tenantId);
return ApiResponse<object>.SuccessResponse(technicalUnit, $"{technicalUnit.Count} record(s) of technical unit fetched successfully", 200);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error fetching technical unit");
return ApiResponse<object>.ErrorResponse("An error occurred while fetching technical unit", ex.Message, 500);
}
}
#endregion
#region =================================================================== Company Type APIs ===================================================================
public async Task<ApiResponse<object>> GetCompanyTypesAsync(Employee loggedInEmployee, Guid tenantId)
{
_logger.LogDebug("GetCompanyType called");
try
{
// Step 1: Fetch company types
var companyTypes = await _context.CompanyTypeMasters.OrderBy(ot => ot.Name).ToListAsync();
_logger.LogInfo("Fetched {Count} company types records for tenantId: {TenantId}", companyTypes.Count, tenantId);
return ApiResponse<object>.SuccessResponse(companyTypes, $"{companyTypes.Count} record(s) of company types fetched successfully", 200);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error fetching company types");
return ApiResponse<object>.ErrorResponse("An error occurred while fetching company types", ex.Message, 500);
}
}
#endregion
#region =================================================================== Organization Type APIs =================================================================== #region =================================================================== Organization Type APIs ===================================================================
public async Task<ApiResponse<object>> GetOrganizationTypesAsync(Employee loggedInEmployee, Guid tenantId) public async Task<ApiResponse<object>> GetOrganizationTypesAsync(Employee loggedInEmployee, Guid tenantId)

View File

@ -20,6 +20,24 @@ namespace Marco.Pms.Services.Service.ServiceInterfaces
#endregion #endregion
#region =================================================================== Unit Type APIs ===================================================================
Task<ApiResponse<object>> GetUnitTypesAsync(Employee loggedInEmployee, Guid tenantId);
#endregion
#region =================================================================== Technical Unit APIs ===================================================================
Task<ApiResponse<object>> GetTechnicalUnitAsync(Guid? unitTypeId, Employee loggedInEmployee, Guid tenantId);
#endregion
#region =================================================================== Company Type APIs ===================================================================
Task<ApiResponse<object>> GetCompanyTypesAsync(Employee loggedInEmployee, Guid tenantId);
#endregion
#region =================================================================== Organization Type APIs =================================================================== #region =================================================================== Organization Type APIs ===================================================================
Task<ApiResponse<object>> GetOrganizationTypesAsync(Employee loggedInEmployee, Guid tenantId); Task<ApiResponse<object>> GetOrganizationTypesAsync(Employee loggedInEmployee, Guid tenantId);