Skip to content

Commit

Permalink
Rename Ticket.ContentType* to Ticket.Type*
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Aug 25, 2023
1 parent 56b2eb3 commit cba8bc0
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 86 deletions.
14 changes: 7 additions & 7 deletions Tzkt.Api/Controllers/TicketsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public async Task<ActionResult<int>> GetTicketsCount([FromQuery] TicketFilter fi
filter.lastTime != null ||
filter.lastLevel != null ||
filter.contentHash != null ||
filter.contentTypeHash != null ||
filter.typeHash != null ||
filter.content != null ||
filter.contentType != null ||
filter.type != null ||
filter.id != null )
{
var query = ResponseCacheService.BuildKey(Request.Path.Value, ("filter", filter));
Expand Down Expand Up @@ -124,7 +124,7 @@ public async Task<ActionResult<int>> GetTicketBalancesCount([FromQuery] TicketBa
filter.ticket.id != null ||
filter.ticket.ticketer != null ||
filter.ticket.contentHash != null ||
filter.ticket.contentTypeHash != null)
filter.ticket.typeHash != null)
{
#region optimizations
if (filter.account != null && (filter.account.Eq == -1 || filter.account.In?.Count == 0 && !filter.account.InHasNull))
Expand Down Expand Up @@ -214,7 +214,7 @@ public async Task<ActionResult<int>> GetTicketTransfersCount([FromQuery] TicketT
filter.smartRollupExecuteId != null ||
filter.ticket.ticketer != null ||
filter.ticket.contentHash != null ||
filter.ticket.contentTypeHash != null ||
filter.ticket.typeHash != null ||
filter.ticket.id != null)
{
#region optimizations
Expand Down Expand Up @@ -300,7 +300,7 @@ public async Task<ActionResult<IEnumerable<TicketTransfer>>> GetTicketTransfers(
/// <remarks>
/// Returns a list of ticket balances at the end of the specified block.
/// Note, this endpoint is quite heavy, therefore at least one of the filters
/// (`account`, `ticket.id`, `ticket.ticketer` with `ticket.contentHash` and `ticket.contentTypeHash`) must be specified.
/// (`account`, `ticket.id`, `ticket.ticketer` with `ticket.contentHash` and `ticket.typeHash`) must be specified.
/// </remarks>
/// <param name="level">Level of the block at the end of which historical balances must be calculated</param>
/// <param name="filter">Filter</param>
Expand All @@ -321,8 +321,8 @@ public async Task<ActionResult<IEnumerable<TicketBalanceShort>>> GetTicketBalanc
filter.ticket.id?.In == null &&
(filter.ticket.ticketer?.Eq == null && filter.ticket.ticketer?.In == null ||
filter.ticket.contentHash?.Eq == null && filter.ticket.contentHash?.In == null ||
filter.ticket.contentTypeHash?.Eq == null && filter.ticket.contentTypeHash?.In == null))
return new BadRequest("query", "At least one of the filters (`account`, `ticket.id`, `ticket.ticketer` with `ticket.contentHash` and `ticket.contentTypeHash`) must be specified");
filter.ticket.typeHash?.Eq == null && filter.ticket.typeHash?.In == null))
return new BadRequest("query", "At least one of the filters (`account`, `ticket.id`, `ticket.ticketer` with `ticket.contentHash` and `ticket.typeHash`) must be specified");

#region optimizations
if (filter.account != null && (filter.account.Eq == -1 || filter.account.In?.Count == 0 && !filter.account.InHasNull))
Expand Down
15 changes: 5 additions & 10 deletions Tzkt.Api/Models/Tickets/Ticket.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using NJsonSchema.Annotations;

namespace Tzkt.Api.Models
namespace Tzkt.Api.Models
{
public class Ticket
{
Expand All @@ -14,25 +11,23 @@ public class Ticket
/// <summary>
/// Contract, created the ticket.
/// </summary>
public Alias Ticketer { get; set; }

public Alias Ticketer { get; set; }

/// <summary>
/// Micheline type of the content
/// </summary>
public RawJson ContentType { get; set; }
public RawJson Type { get; set; }

/// <summary>
/// Ticket content
/// </summary>
public object Content { get; set; }

public object Content { get; set; }

/// <summary>
/// 32-bit hash of the ticket content type.
/// This field can be used for searching similar tickets (which have the same type).
/// </summary>
public int ContentTypeHash { get; set; }
public int TypeHash { get; set; }

/// <summary>
/// 32-bit hash of the ticket content.
Expand Down
4 changes: 2 additions & 2 deletions Tzkt.Api/Models/Tickets/TicketInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TicketInfo
/// <summary>
/// Micheline type of the content
/// </summary>
public RawJson ContentType { get; set; }
public RawJson Type { get; set; }

/// <summary>
/// Ticket content
Expand All @@ -28,7 +28,7 @@ public class TicketInfo
/// 32-bit hash of the ticket content type.
/// This field can be used for searching similar tickets (which have the same type).
/// </summary>
public int ContentTypeHash { get; set; }
public int TypeHash { get; set; }

/// <summary>
/// 32-bit hash of the ticket content.
Expand Down
10 changes: 5 additions & 5 deletions Tzkt.Api/Parameters/TicketFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class TicketFilter : INormalizable
/// Filter by 32-bit hash of ticket content type (helpful for searching same tickets).
/// Click on the parameter to expand more details.
/// </summary>
public Int32Parameter contentTypeHash { get; set; }
public Int32Parameter typeHash { get; set; }

/// <summary>
/// Filter by content.
Expand All @@ -69,18 +69,18 @@ public class TicketFilter : INormalizable

/// <summary>
/// Filter by content type.
/// Note, this parameter supports the following format: `contentType{.path?}{.mode?}=...`,
/// so you can specify a path to a particular field to filter by (for example, `?contentType.prim.in=string,int`).
/// Note, this parameter supports the following format: `type{.path?}{.mode?}=...`,
/// so you can specify a path to a particular field to filter by (for example, `?type.prim.in=string,int`).
/// Click on the parameter to expand more details.
/// </summary>
public JsonParameter contentType { get; set; }
public JsonParameter type { get; set; }

public string Normalize(string name)
{
return ResponseCacheService.BuildKey("",
("id", id), ("ticketer", ticketer), ("firstMinter", firstMinter), ("firstLevel", firstLevel),
("firstTime", firstTime), ("lastLevel", lastLevel), ("lastTime", lastTime), ("contentHash", contentHash),
("contentTypeHash", contentTypeHash), ("content", content), ("contentType", contentType));
("typeHash", typeHash), ("content", content), ("type", type));
}
}
}
4 changes: 2 additions & 2 deletions Tzkt.Api/Parameters/TicketInfoFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public class TicketInfoFilter : INormalizable
/// Filter by 32-bit hash of ticket content type (helpful for searching same tickets).
/// Click on the parameter to expand more details.
/// </summary>
public Int32Parameter contentTypeHash { get; set; }
public Int32Parameter typeHash { get; set; }

public string Normalize(string name)
{
return ResponseCacheService.BuildKey("",
("id", id), ("ticketer", ticketer), ("contentHash", contentHash), ("contentTypeHash", contentTypeHash));
("id", id), ("ticketer", ticketer), ("contentHash", contentHash), ("typeHash", typeHash));
}
}
}
Loading

0 comments on commit cba8bc0

Please sign in to comment.