Changes committed
This commit is contained in:
6
oss-microservices/Shared.Contracts/Class1.cs
Normal file
6
oss-microservices/Shared.Contracts/Class1.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Shared.Contracts;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
26
oss-microservices/Shared.Contracts/Constants/Errors.cs
Normal file
26
oss-microservices/Shared.Contracts/Constants/Errors.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Shared.Contracts.Enums;
|
||||
|
||||
namespace Shared.Contracts.Constants;
|
||||
|
||||
public record Error(ErrorCode Code, string Message);
|
||||
|
||||
public static class Errors
|
||||
{
|
||||
public static readonly Error Success =
|
||||
new(ErrorCode.Success, "Success");
|
||||
|
||||
public static readonly Error BadRequest =
|
||||
new(ErrorCode.BadRequest, "Invalid request.");
|
||||
|
||||
public static readonly Error ValidationFailed =
|
||||
new(ErrorCode.ValidationFailed, "Validation failed.");
|
||||
|
||||
public static readonly Error Unauthorized =
|
||||
new(ErrorCode.Unauthorized, "Unauthorized access.");
|
||||
|
||||
public static readonly Error NotFound =
|
||||
new(ErrorCode.NotFound, "Resource not found.");
|
||||
|
||||
public static readonly Error InternalServerError =
|
||||
new(ErrorCode.InternalServerError, "An unexpected error occurred.");
|
||||
}
|
||||
26
oss-microservices/Shared.Contracts/Enums/ErrorCode.cs
Normal file
26
oss-microservices/Shared.Contracts/Enums/ErrorCode.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace Shared.Contracts.Enums;
|
||||
|
||||
public enum ErrorCode
|
||||
{
|
||||
Success = 200,
|
||||
|
||||
BadRequest = 1000,
|
||||
ValidationFailed = 1001,
|
||||
Unauthorized = 1002,
|
||||
Forbidden = 1003,
|
||||
NotFound = 1004,
|
||||
Conflict = 1005,
|
||||
|
||||
InternalServerError = 2000,
|
||||
DatabaseError = 2001,
|
||||
ExternalServiceError = 2002,
|
||||
|
||||
InvalidCredentials = 3000,
|
||||
InvalidToken = 3001,
|
||||
TokenExpired = 3002,
|
||||
|
||||
ResourceAlreadyExists = 4000,
|
||||
ResourceNotFound = 4001,
|
||||
|
||||
UnknownError = 9999
|
||||
}
|
||||
18
oss-microservices/Shared.Contracts/Payloads/ApiResponse.cs
Normal file
18
oss-microservices/Shared.Contracts/Payloads/ApiResponse.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Shared.Contracts.Constants;
|
||||
|
||||
namespace Shared.Contracts.Payloads;
|
||||
|
||||
public record ApiResponse<T>(
|
||||
bool Success,
|
||||
T? Data,
|
||||
Error? Error
|
||||
);
|
||||
|
||||
public static class ApiResponse
|
||||
{
|
||||
public static ApiResponse<T> Ok<T>(T data) =>
|
||||
new(true, data, null);
|
||||
|
||||
public static ApiResponse<T> Fail<T>(Error error) =>
|
||||
new(false, default, error);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"Shared.Contracts/1.0.0": {
|
||||
"runtime": {
|
||||
"Shared.Contracts.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"Shared.Contracts/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Shared.Contracts")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8537c653c1732fbc92105aff39e0ff486be9639f")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Shared.Contracts")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Shared.Contracts")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
bfbd83389af9bc3dbdfd5424045f412e7821acb11023eb7043be18102bb32fd3
|
||||
@@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = Shared.Contracts
|
||||
build_property.ProjectDir = /Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
@@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
89cba25ee72976a6424837372b95abd72f75d64b6fb05ee4d393cff5bd1efab7
|
||||
@@ -0,0 +1,11 @@
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/bin/Debug/net8.0/Shared.Contracts.deps.json
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/bin/Debug/net8.0/Shared.Contracts.dll
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/bin/Debug/net8.0/Shared.Contracts.pdb
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/Shared.Contracts.GeneratedMSBuildEditorConfig.editorconfig
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/Shared.Contracts.AssemblyInfoInputs.cache
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/Shared.Contracts.AssemblyInfo.cs
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/Shared.Contracts.csproj.CoreCompileInputs.cache
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/Shared.Contracts.dll
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/refint/Shared.Contracts.dll
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/Shared.Contracts.pdb
|
||||
/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/Debug/net8.0/ref/Shared.Contracts.dll
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/Shared.Contracts.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/Shared.Contracts.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/Shared.Contracts.csproj",
|
||||
"projectName": "Shared.Contracts",
|
||||
"projectPath": "/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/Shared.Contracts.csproj",
|
||||
"packagesPath": "/Users/maddy/.nuget/packages/",
|
||||
"outputPath": "/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"/Users/maddy/.nuget/NuGet/NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.421/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/maddy/.nuget/packages/</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/maddy/.nuget/packages/</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.2</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="/Users/maddy/.nuget/packages/" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
71
oss-microservices/Shared.Contracts/obj/project.assets.json
Normal file
71
oss-microservices/Shared.Contracts/obj/project.assets.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net8.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net8.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"/Users/maddy/.nuget/packages/": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/Shared.Contracts.csproj",
|
||||
"projectName": "Shared.Contracts",
|
||||
"projectPath": "/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/Shared.Contracts.csproj",
|
||||
"packagesPath": "/Users/maddy/.nuget/packages/",
|
||||
"outputPath": "/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/obj/",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"/Users/maddy/.nuget/NuGet/NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.421/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "fdD3+DhpN7Q=",
|
||||
"success": true,
|
||||
"projectFilePath": "/Users/maddy/Projects/OCR/oss-microservices/Shared.Contracts/Shared.Contracts.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": []
|
||||
}
|
||||
Reference in New Issue
Block a user