aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-04-29 19:17:03 +0800
committercrupest <crupest@outlook.com>2021-04-29 19:17:03 +0800
commitaf5bab651a56a04468654c06057ab6d5ee28f18b (patch)
tree9d5a169be5aff26a5224c1997b4d47ba486a550a
parent2075e4098025001073b5eca025632cbb3199c316 (diff)
downloadtimeline-af5bab651a56a04468654c06057ab6d5ee28f18b.tar.gz
timeline-af5bab651a56a04468654c06057ab6d5ee28f18b.tar.bz2
timeline-af5bab651a56a04468654c06057ab6d5ee28f18b.zip
refactor: ...
-rw-r--r--BackEnd/Timeline/GlobalSuppressions.cs3
-rw-r--r--BackEnd/Timeline/Helpers/LanguageHelper.cs12
-rw-r--r--BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs144
-rw-r--r--BackEnd/Timeline/Resources/Services/TimelineService.resx147
-rw-r--r--BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs72
-rw-r--r--BackEnd/Timeline/Resources/Services/UserTokenService.resx123
-rw-r--r--BackEnd/Timeline/Services/Timeline/Resource.Designer.cs135
-rw-r--r--BackEnd/Timeline/Services/Timeline/Resource.resx45
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelinePostService.cs33
-rw-r--r--BackEnd/Timeline/Services/Timeline/TimelineService.cs15
-rw-r--r--BackEnd/Timeline/Services/Token/Resource.Designer.cs9
-rw-r--r--BackEnd/Timeline/Services/Token/Resource.resx3
-rw-r--r--BackEnd/Timeline/Services/Token/UserTokenHandler.cs2
-rw-r--r--BackEnd/Timeline/Timeline.csproj18
14 files changed, 222 insertions, 539 deletions
diff --git a/BackEnd/Timeline/GlobalSuppressions.cs b/BackEnd/Timeline/GlobalSuppressions.cs
index 1d6905a5..52d36ff7 100644
--- a/BackEnd/Timeline/GlobalSuppressions.cs
+++ b/BackEnd/Timeline/GlobalSuppressions.cs
@@ -10,7 +10,4 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Generated error response identifiers.", Scope = "type", Target = "~T:Timeline.Models.Http.ErrorResponse")]
[assembly: SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Generated error response identifiers.", Scope = "type", Target = "~T:Timeline.Models.Http.ErrorResponse")]
[assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "Generated error response.", Scope = "type", Target = "~T:Timeline.Models.Http.ErrorResponse")]
-[assembly: SuppressMessage("Design", "CA1056:Uri properties should not be strings", Justification = "That's unnecessary.")]
[assembly: SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "Redundant")]
-[assembly: SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "No localization demand.")]
-[assembly: SuppressMessage("Design", "CA1054:URI-like parameters should not be strings")]
diff --git a/BackEnd/Timeline/Helpers/LanguageHelper.cs b/BackEnd/Timeline/Helpers/LanguageHelper.cs
deleted file mode 100644
index b0156b8b..00000000
--- a/BackEnd/Timeline/Helpers/LanguageHelper.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Linq;
-
-namespace Timeline.Helpers
-{
- public static class LanguageHelper
- {
- public static bool AreSame(this bool firstBool, params bool[] otherBools)
- {
- return otherBools.All(b => b == firstBool);
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs b/BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs
deleted file mode 100644
index e16c1337..00000000
--- a/BackEnd/Timeline/Resources/Services/TimelineService.Designer.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Services {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class TimelineService {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal TimelineService() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Services.TimelineService", typeof(TimelineService).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The number {0} username is invalid..
- /// </summary>
- internal static string ExceptionChangeMemberUsernameBadFormat {
- get {
- return ResourceManager.GetString("ExceptionChangeMemberUsernameBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Unknown post content type &quot;{0}&quot; is saved in database..
- /// </summary>
- internal static string ExceptionDatabaseUnknownContentType {
- get {
- return ResourceManager.GetString("ExceptionDatabaseUnknownContentType", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The owner username of personal timeline is of bad format..
- /// </summary>
- internal static string ExceptionFindTimelineUsernameBadFormat {
- get {
- return ResourceManager.GetString("ExceptionFindTimelineUsernameBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The data entry of the tag of the image post does not exist..
- /// </summary>
- internal static string ExceptionGetDataDataEntryNotExist {
- get {
- return ResourceManager.GetString("ExceptionGetDataDataEntryNotExist", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Can&apos;t get data of a non-image post..
- /// </summary>
- internal static string ExceptionGetDataNonImagePost {
- get {
- return ResourceManager.GetString("ExceptionGetDataNonImagePost", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The post has been deleted because content of entity is null..
- /// </summary>
- internal static string ExceptionPostDeleted {
- get {
- return ResourceManager.GetString("ExceptionPostDeleted", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The timeline name is of bad format..
- /// </summary>
- internal static string ExceptionTimelineNameBadFormat {
- get {
- return ResourceManager.GetString("ExceptionTimelineNameBadFormat", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to The timeline with given name already exists..
- /// </summary>
- internal static string ExceptionTimelineNameConflict {
- get {
- return ResourceManager.GetString("ExceptionTimelineNameConflict", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Image format type of the post does not exist in column &quot;extra_content&quot;. Normally this couldn&apos;t be possible because it should be saved when post was created. However, we now re-detect the format and save it..
- /// </summary>
- internal static string LogGetDataNoFormat {
- get {
- return ResourceManager.GetString("LogGetDataNoFormat", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Services/TimelineService.resx b/BackEnd/Timeline/Resources/Services/TimelineService.resx
deleted file mode 100644
index 9314f51b..00000000
--- a/BackEnd/Timeline/Resources/Services/TimelineService.resx
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExceptionChangeMemberUsernameBadFormat" xml:space="preserve">
- <value>The number {0} username is invalid.</value>
- </data>
- <data name="ExceptionDatabaseUnknownContentType" xml:space="preserve">
- <value>Unknown post content type "{0}" is saved in database.</value>
- </data>
- <data name="ExceptionFindTimelineUsernameBadFormat" xml:space="preserve">
- <value>The owner username of personal timeline is of bad format.</value>
- </data>
- <data name="ExceptionGetDataDataEntryNotExist" xml:space="preserve">
- <value>The data entry of the tag of the image post does not exist.</value>
- </data>
- <data name="ExceptionGetDataNonImagePost" xml:space="preserve">
- <value>Can't get data of a non-image post.</value>
- </data>
- <data name="ExceptionTimelineNameBadFormat" xml:space="preserve">
- <value>The timeline name is of bad format.</value>
- </data>
- <data name="ExceptionTimelineNameConflict" xml:space="preserve">
- <value>The timeline with given name already exists.</value>
- </data>
- <data name="LogGetDataNoFormat" xml:space="preserve">
- <value>Image format type of the post does not exist in column "extra_content". Normally this couldn't be possible because it should be saved when post was created. However, we now re-detect the format and save it.</value>
- </data>
- <data name="ExceptionPostDeleted" xml:space="preserve">
- <value>The post has been deleted because content of entity is null.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs b/BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs
deleted file mode 100644
index 3c3c7e41..00000000
--- a/BackEnd/Timeline/Resources/Services/UserTokenService.Designer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Timeline.Resources.Services {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class UserTokenService {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal UserTokenService() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Timeline.Resources.Services.UserTokenService", typeof(UserTokenService).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Jwt token key is not set in database. Maybe you forget to migrate the database..
- /// </summary>
- internal static string JwtKeyNotExist {
- get {
- return ResourceManager.GetString("JwtKeyNotExist", resourceCulture);
- }
- }
- }
-}
diff --git a/BackEnd/Timeline/Resources/Services/UserTokenService.resx b/BackEnd/Timeline/Resources/Services/UserTokenService.resx
deleted file mode 100644
index 1ce78427..00000000
--- a/BackEnd/Timeline/Resources/Services/UserTokenService.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="JwtKeyNotExist" xml:space="preserve">
- <value>Jwt token key is not set in database. Maybe you forget to migrate the database.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs b/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs
index 6faea295..5ad03011 100644
--- a/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs
+++ b/BackEnd/Timeline/Services/Timeline/Resource.Designer.cs
@@ -61,6 +61,42 @@ namespace Timeline.Services.Timeline {
}
/// <summary>
+ /// Looks up a localized string similar to Color is not valid. {0}.
+ /// </summary>
+ internal static string ExceptionColorInvalid {
+ get {
+ return ResourceManager.GetString("ExceptionColorInvalid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Data list can&apos;t be empty..
+ /// </summary>
+ internal static string ExceptionDataListEmpty {
+ get {
+ return ResourceManager.GetString("ExceptionDataListEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Data list can&apos;t be null..
+ /// </summary>
+ internal static string ExceptionDataListNull {
+ get {
+ return ResourceManager.GetString("ExceptionDataListNull", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Data list count can&apos;t be bigger than 100..
+ /// </summary>
+ internal static string ExceptionDataListTooLarge {
+ get {
+ return ResourceManager.GetString("ExceptionDataListTooLarge", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to This timeline name is neither a valid personal timeline name nor a valid ordinary timeline name. {0}.
/// </summary>
internal static string ExceptionGeneralTimelineNameBadFormat {
@@ -70,6 +106,33 @@ namespace Timeline.Services.Timeline {
}
/// <summary>
+ /// Looks up a localized string similar to Image validation failed..
+ /// </summary>
+ internal static string ExceptionPostDataImageInvalid {
+ get {
+ return ResourceManager.GetString("ExceptionPostDataImageInvalid", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to It is not a valid utf-8 sequence..
+ /// </summary>
+ internal static string ExceptionPostDataNotValidUtf8 {
+ get {
+ return ResourceManager.GetString("ExceptionPostDataNotValidUtf8", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unsupported content type..
+ /// </summary>
+ internal static string ExceptionPostDataUnsupportedType {
+ get {
+ return ResourceManager.GetString("ExceptionPostDataUnsupportedType", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Timeline with given constraints already exist..
/// </summary>
internal static string ExceptionTimelineAlreadyExist {
@@ -131,5 +194,77 @@ namespace Timeline.Services.Timeline {
return ResourceManager.GetString("LogPersonalTimelineAutoCreate", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to A member(user id={0}) is added to timeline(id={1})..
+ /// </summary>
+ internal static string LogTimelineAddMember {
+ get {
+ return ResourceManager.GetString("LogTimelineAddMember", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline is created with name={0}, id={1}..
+ /// </summary>
+ internal static string LogTimelineCreate {
+ get {
+ return ResourceManager.GetString("LogTimelineCreate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) is deleted..
+ /// </summary>
+ internal static string LogTimelineDelete {
+ get {
+ return ResourceManager.GetString("LogTimelineDelete", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) post(id={1}) is created..
+ /// </summary>
+ internal static string LogTimelinePostCreated {
+ get {
+ return ResourceManager.GetString("LogTimelinePostCreated", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) post(id={1}) is deleted..
+ /// </summary>
+ internal static string LogTimelinePostDeleted {
+ get {
+ return ResourceManager.GetString("LogTimelinePostDeleted", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A timeline(id={0}) post(id={1}) is updated..
+ /// </summary>
+ internal static string LogTimelinePostUpdated {
+ get {
+ return ResourceManager.GetString("LogTimelinePostUpdated", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A member(user id={0}) is removed from timeline(id={1})..
+ /// </summary>
+ internal static string LogTimelineRemoveMember {
+ get {
+ return ResourceManager.GetString("LogTimelineRemoveMember", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Timeline with id={0} is updated..
+ /// </summary>
+ internal static string LogTimelineUpdated {
+ get {
+ return ResourceManager.GetString("LogTimelineUpdated", resourceCulture);
+ }
+ }
}
}
diff --git a/BackEnd/Timeline/Services/Timeline/Resource.resx b/BackEnd/Timeline/Services/Timeline/Resource.resx
index 3a233e55..cc293d05 100644
--- a/BackEnd/Timeline/Services/Timeline/Resource.resx
+++ b/BackEnd/Timeline/Services/Timeline/Resource.resx
@@ -117,9 +117,30 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="ExceptionColorInvalid" xml:space="preserve">
+ <value>Color is not valid. {0}</value>
+ </data>
+ <data name="ExceptionDataListEmpty" xml:space="preserve">
+ <value>Data list can't be empty.</value>
+ </data>
+ <data name="ExceptionDataListNull" xml:space="preserve">
+ <value>Data list can't be null.</value>
+ </data>
+ <data name="ExceptionDataListTooLarge" xml:space="preserve">
+ <value>Data list count can't be bigger than 100.</value>
+ </data>
<data name="ExceptionGeneralTimelineNameBadFormat" xml:space="preserve">
<value>This timeline name is neither a valid personal timeline name nor a valid ordinary timeline name. {0}</value>
</data>
+ <data name="ExceptionPostDataImageInvalid" xml:space="preserve">
+ <value>Image validation failed.</value>
+ </data>
+ <data name="ExceptionPostDataNotValidUtf8" xml:space="preserve">
+ <value>It is not a valid utf-8 sequence.</value>
+ </data>
+ <data name="ExceptionPostDataUnsupportedType" xml:space="preserve">
+ <value>Unsupported content type.</value>
+ </data>
<data name="ExceptionTimelineAlreadyExist" xml:space="preserve">
<value>Timeline with given constraints already exist.</value>
</data>
@@ -141,4 +162,28 @@
<data name="LogPersonalTimelineAutoCreate" xml:space="preserve">
<value>A personal timeline for user with username={0} is created automatically.</value>
</data>
+ <data name="LogTimelineAddMember" xml:space="preserve">
+ <value>A member(user id={0}) is added to timeline(id={1}).</value>
+ </data>
+ <data name="LogTimelineCreate" xml:space="preserve">
+ <value>A timeline is created with name={0}, id={1}.</value>
+ </data>
+ <data name="LogTimelineDelete" xml:space="preserve">
+ <value>A timeline(id={0}) is deleted.</value>
+ </data>
+ <data name="LogTimelinePostCreated" xml:space="preserve">
+ <value>A timeline(id={0}) post(id={1}) is created.</value>
+ </data>
+ <data name="LogTimelinePostDeleted" xml:space="preserve">
+ <value>A timeline(id={0}) post(id={1}) is deleted.</value>
+ </data>
+ <data name="LogTimelinePostUpdated" xml:space="preserve">
+ <value>A timeline(id={0}) post(id={1}) is updated.</value>
+ </data>
+ <data name="LogTimelineRemoveMember" xml:space="preserve">
+ <value>A member(user id={0}) is removed from timeline(id={1}).</value>
+ </data>
+ <data name="LogTimelineUpdated" xml:space="preserve">
+ <value>Timeline with id={0} is updated.</value>
+ </data>
</root> \ No newline at end of file
diff --git a/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs b/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs
index 65a01b37..a9bb7bd1 100644
--- a/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs
+++ b/BackEnd/Timeline/Services/Timeline/TimelinePostService.cs
@@ -50,6 +50,12 @@ namespace Timeline.Services.Timeline
throw new UserNotExistException(userId);
}
+ private void CheckColor(string color, string paramName)
+ {
+ if (!_colorValidator.Validate(color, out var message))
+ throw new ArgumentException(string.Format(Resource.ExceptionColorInvalid, message), paramName);
+ }
+
public async Task<List<TimelinePostEntity>> GetPostsAsync(long timelineId, DateTime? modifiedSince = null, bool includeDeleted = false)
{
await CheckTimelineExistence(timelineId);
@@ -139,19 +145,17 @@ namespace Timeline.Services.Timeline
if (request is null)
throw new ArgumentNullException(nameof(request));
- {
- if (!_colorValidator.Validate(request.Color, out var message))
- throw new ArgumentException("Color is not valid.", nameof(request));
- }
+ if (request.Color is not null)
+ CheckColor(request.Color, nameof(request));
if (request.DataList is null)
- throw new ArgumentException("Data list can't be null.", nameof(request));
+ throw new ArgumentException(Resource.ExceptionDataListNull, nameof(request));
if (request.DataList.Count == 0)
- throw new ArgumentException("Data list can't be empty.", nameof(request));
+ throw new ArgumentException(Resource.ExceptionDataListEmpty, nameof(request));
if (request.DataList.Count > 100)
- throw new ArgumentException("Data list count can't be bigger than 100.", nameof(request));
+ throw new ArgumentException(Resource.ExceptionDataListTooLarge, nameof(request));
for (int index = 0; index < request.DataList.Count; index++)
{
@@ -169,7 +173,7 @@ namespace Timeline.Services.Timeline
}
catch (ImageException e)
{
- throw new TimelinePostCreateDataException(index, "Image validation failed.", e);
+ throw new TimelinePostCreateDataException(index, Resource.ExceptionPostDataImageInvalid, e);
}
break;
case MimeTypes.TextPlain:
@@ -180,11 +184,11 @@ namespace Timeline.Services.Timeline
}
catch (DecoderFallbackException e)
{
- throw new TimelinePostCreateDataException(index, "Text is not a valid utf-8 sequence.", e);
+ throw new TimelinePostCreateDataException(index, Resource.ExceptionPostDataNotValidUtf8, e);
}
break;
default:
- throw new TimelinePostCreateDataException(index, "Unsupported content type.");
+ throw new TimelinePostCreateDataException(index, Resource.ExceptionPostDataUnsupportedType);
}
}
@@ -234,6 +238,7 @@ namespace Timeline.Services.Timeline
await _database.SaveChangesAsync();
await transaction.CommitAsync();
+ _logger.LogInformation(Resource.LogTimelinePostCreated, timelineId, postEntity.Id);
return postEntity;
}
@@ -243,10 +248,8 @@ namespace Timeline.Services.Timeline
if (request is null)
throw new ArgumentNullException(nameof(request));
- {
- if (!_colorValidator.Validate(request.Color, out var message))
- throw new ArgumentException("Color is not valid.", nameof(request));
- }
+ if (request.Color is not null)
+ CheckColor(request.Color, nameof(request));
request.Time = request.Time?.MyToUtc();
@@ -269,6 +272,7 @@ namespace Timeline.Services.Timeline
entity.LastUpdated = _clock.GetCurrentTime();
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelinePostUpdated, timelineId, postId);
return entity;
}
@@ -302,6 +306,7 @@ namespace Timeline.Services.Timeline
await _database.SaveChangesAsync();
await transaction.CommitAsync();
+ _logger.LogWarning(Resource.LogTimelinePostDeleted, timelineId, postId);
}
public async Task DeleteAllPostsOfUserAsync(long userId)
diff --git a/BackEnd/Timeline/Services/Timeline/TimelineService.cs b/BackEnd/Timeline/Services/Timeline/TimelineService.cs
index cea93272..bde0210a 100644
--- a/BackEnd/Timeline/Services/Timeline/TimelineService.cs
+++ b/BackEnd/Timeline/Services/Timeline/TimelineService.cs
@@ -23,7 +23,6 @@ namespace Timeline.Services.Timeline
private readonly IClock _clock;
private readonly TimelineNameValidator _timelineNameValidator = new TimelineNameValidator();
-
private readonly ColorValidator _colorValidator = new ColorValidator();
public TimelineService(ILoggerFactory loggerFactory, DatabaseContext database, IBasicUserService userService, IClock clock)
@@ -36,7 +35,7 @@ namespace Timeline.Services.Timeline
}
- private void ValidateTimelineName(string name, string paramName)
+ private void CheckTimelineName(string name, string paramName)
{
if (!_timelineNameValidator.Validate(name, out var message))
{
@@ -60,7 +59,7 @@ namespace Timeline.Services.Timeline
throw new ArgumentNullException(nameof(newProperties));
if (newProperties.Name is not null)
- ValidateTimelineName(newProperties.Name, nameof(newProperties));
+ CheckTimelineName(newProperties.Name, nameof(newProperties));
if (newProperties.Color is not null)
{
@@ -125,6 +124,7 @@ namespace Timeline.Services.Timeline
}
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineUpdated, id);
}
public async Task<bool> AddMemberAsync(long timelineId, long userId)
@@ -138,7 +138,6 @@ namespace Timeline.Services.Timeline
if (await _database.TimelineMembers.AnyAsync(m => m.TimelineId == timelineId && m.UserId == userId))
return false;
-
var entity = new TimelineMemberEntity { UserId = userId, TimelineId = timelineId };
_database.TimelineMembers.Add(entity);
@@ -146,6 +145,8 @@ namespace Timeline.Services.Timeline
timelineEntity.LastModified = _clock.GetCurrentTime();
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineAddMember, userId, timelineId);
+
return true;
}
@@ -166,6 +167,8 @@ namespace Timeline.Services.Timeline
timelineEntity.LastModified = _clock.GetCurrentTime();
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineRemoveMember, userId, timelineId);
+
return true;
}
@@ -258,7 +261,7 @@ namespace Timeline.Services.Timeline
if (name == null)
throw new ArgumentNullException(nameof(name));
- ValidateTimelineName(name, nameof(name));
+ CheckTimelineName(name, nameof(name));
var conflict = await _database.Timelines.AnyAsync(t => t.Name == name);
@@ -269,6 +272,7 @@ namespace Timeline.Services.Timeline
_database.Timelines.Add(entity);
await _database.SaveChangesAsync();
+ _logger.LogInformation(Resource.LogTimelineCreate, name, entity.Id);
return entity;
}
@@ -282,6 +286,7 @@ namespace Timeline.Services.Timeline
_database.Timelines.Remove(entity);
await _database.SaveChangesAsync();
+ _logger.LogWarning(Resource.LogTimelineDelete, id);
}
}
}
diff --git a/BackEnd/Timeline/Services/Token/Resource.Designer.cs b/BackEnd/Timeline/Services/Token/Resource.Designer.cs
index 07b0057f..ac6f3707 100644
--- a/BackEnd/Timeline/Services/Token/Resource.Designer.cs
+++ b/BackEnd/Timeline/Services/Token/Resource.Designer.cs
@@ -61,6 +61,15 @@ namespace Timeline.Services.Token {
}
/// <summary>
+ /// Looks up a localized string similar to Jwt key is not found. Maybe you forget to do the migration..
+ /// </summary>
+ internal static string ExceptionJwtKeyNotExist {
+ get {
+ return ResourceManager.GetString("ExceptionJwtKeyNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to The token didn&apos;t pass verification because {0}..
/// </summary>
internal static string ExceptionJwtUserTokenBadFormat {
diff --git a/BackEnd/Timeline/Services/Token/Resource.resx b/BackEnd/Timeline/Services/Token/Resource.resx
index 7abf2e75..06bf03f6 100644
--- a/BackEnd/Timeline/Services/Token/Resource.resx
+++ b/BackEnd/Timeline/Services/Token/Resource.resx
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="ExceptionJwtKeyNotExist" xml:space="preserve">
+ <value>Jwt key is not found. Maybe you forget to do the migration.</value>
+ </data>
<data name="ExceptionJwtUserTokenBadFormat" xml:space="preserve">
<value>The token didn't pass verification because {0}.</value>
</data>
diff --git a/BackEnd/Timeline/Services/Token/UserTokenHandler.cs b/BackEnd/Timeline/Services/Token/UserTokenHandler.cs
index 7b57a06c..c1633f4a 100644
--- a/BackEnd/Timeline/Services/Token/UserTokenHandler.cs
+++ b/BackEnd/Timeline/Services/Token/UserTokenHandler.cs
@@ -29,7 +29,7 @@ namespace Timeline.Services.Token
if (key == null)
{
- throw new InvalidOperationException(Resources.Services.UserTokenService.JwtKeyNotExist);
+ throw new InvalidOperationException(Resource.ExceptionJwtKeyNotExist);
}
_tokenSecurityKey = new SymmetricSecurityKey(key);
diff --git a/BackEnd/Timeline/Timeline.csproj b/BackEnd/Timeline/Timeline.csproj
index 8cf1b31f..f77631c2 100644
--- a/BackEnd/Timeline/Timeline.csproj
+++ b/BackEnd/Timeline/Timeline.csproj
@@ -128,16 +128,6 @@
<AutoGen>True</AutoGen>
<DependentUpon>Validator.resx</DependentUpon>
</Compile>
- <Compile Update="Resources\Services\TimelineService.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>TimelineService.resx</DependentUpon>
- </Compile>
- <Compile Update="Resources\Services\UserTokenService.Designer.cs">
- <DesignTime>True</DesignTime>
- <AutoGen>True</AutoGen>
- <DependentUpon>UserTokenService.resx</DependentUpon>
- </Compile>
<Compile Update="Services\DatabaseManagement\Resource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
@@ -251,14 +241,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Validator.Designer.cs</LastGenOutput>
</EmbeddedResource>
- <EmbeddedResource Update="Resources\Services\TimelineService.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>TimelineService.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <EmbeddedResource Update="Resources\Services\UserTokenService.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>UserTokenService.Designer.cs</LastGenOutput>
- </EmbeddedResource>
<EmbeddedResource Update="Services\DatabaseManagement\Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>