One-Piece

Tag

  • A: Means admin only
  • I: Means in-service call only
  • D: Depreacted

Response Interface

interface ResponseBase {
    status: 'error' | 'success';
}

interface CustomResponse<T> extends ResponseBase {
    statusCode?: number;
    message?: T;
}

interface BuildInExceptionResponse extends ResponseBase {
    error: string;
}

interface CustomExceptionResponse extends ResponseBase {
    response: {
        status: "error",
        error: string;
    },
    message: string;
}

type Response<T> = CustomResponse<T> & BuildInExceptionResponse & CustomExceptionResponse;

Chats 13

Base Interface

interface Base {
    createdAt: Date;
    updatedAt: Date;
}

Enumerate

enum EChatRoomSocketEvent {
    // chatroom settings
    'CREATECHATROOM' = 'createchatroom',
    'UPDATECHATROOM' = 'updatechatroom',
    'DELETECHATROOM' = 'deletechatroom',
    // participate
    'UPDATEPARTICIPATE' = 'updateparticipate',
    'DELETEPARTICIPATE' = 'deleteparticipate',
    // message
    'NEWCHATMESSAGE' = 'newchatmessage',
    'UPDATESENDSTATUSMSG' = 'updatesendstatusmsg',
    'UPDATEREADSTATUSMSG' = 'updatereadstatusmsg',
}

enum EChatRoomType {
    'PUBLIC' = 'public',
    'PRIVATE' = 'private',
    'GROUP' = 'group',
}

enum EChatSendStatus {
    'FAIL' = 'fail',
    'SENDING' = 'sending',
    'FINISH' = 'finish',
}

enum EChatStatus {
    'READ' = 'read',
    'UNREAD' = 'unread',
}

enum EUserRole {
    'TRIAL' = 'trial',
    'USER' = 'user',
    'VIP1' = 'vip1',
    'VIP2' = 'vip2',
    'ADMIN' = 'admin',
}

enum EUserGender {
    'MALE' = 'male',
    'FEMALE' = 'female',
}

ChatRoom Interface

interface ChatRoom extends Base {
    id: string;
    name: string;
    type: EChatRoomType;
    chatParticipate: ChatParticipate;
    version: number;
}

chatParticipate Interface

interface ChatParticipate extends Base {
    id: string;
    chatRoom: ChatRoom;
    chats: Chat[];
    users: User[];
    version: number;
}

Chat Interface

interface Chat extends Base {
    id: string;
    message: string;
    sendStatus: EChatSendStatus;
    readStatus: EChatStatus;
    chatParticipate: ChatParticipate;
    version: number;
}

User Interface

interface User extends Base {
    id: string;
    role: EUserRole;
    expiredDate: Date;
    diamondCoin: number; // default 0
    goldCoin: number; // default 10
    username: string;
    email: string;
    status: boolean; // default true
    gender?: EUserGender
    age?: number;
    desc?: string;
    profileImage?: string;
    chatParticipates: ChatParticipates[];
    followers: User[];
    followings: User[];
    blockLists: User[];
    followerCount: number;
    followingCount: number;
    version: number;
}
Description

Description:

  • Create a new trip

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
name(Required)Chatroom namestringBody
type(Required)Chatroom type EChatRoomTypeenumerateBody
welcomeMessage(Required)Welcome Message when people enter chatroomstringBody
requestUserId(Required)Person who create the chatroomstringBody
responseUserId(Required)Person who get invited to the chatroomstringBody

Request interface:

enum EChatRoomType {
  'PUBLIC' = 'public',
  'PRIVATE' = 'private',
  'GROUP' = 'group',
}

interface AuthHeader {
    authorization: string;
}

interface CreateChatrooomDto {
    name: string;
    type: EChatRoomType; // default private
    welcomeMessage: string;
    requestUserId: string;
    responseUserId: string;
}

type Request = CreateChatrooomDto & AuthHeader;

Response interface:

type Response<Chatroom>;


Headers
KeyValueDescription
service-nameone-piece-chat
Content-Typeapplication/json
Body
{ "name": "lib-Chat-test1", "type": "private", "welcomeMessage": "靠", "requestUserId": "735ca6d1-7a2f-45b5-bce7-42706751d12e", "responseUserId": "9b501158-f4eb-48ba-823e-7d88b80b7127" }
Description

Description:

  • Create a new trip

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
message(Required)chat messagestringBody
chatParitcipateId(Required)relations with chatParitcipate pkstringBody
requestUserId(Required)Person who create the chatroomstringBody
responseUserId(Required)Person who get invited to the chatroomstringBody

Request interface:

interface AuthHeader {
    authorization: string;
}

interface CreatChatDto {
    message: string;
    chatParitcipateId: string;
    requestUserId: string;
    responseUserId: string;
}

type Request = CreatChatDto & AuthHeader;

Response interface:

type Response<Chat>;


Headers
KeyValueDescription
service-nameone-piece-chat
Content-Typeapplication/json
Body
{ "message": "我是誰,我在哪9", "chatParitcipateId": "fb2ea0dd-851a-4f93-92d8-0787af9203f3", "requestUserId": "735ca6d1-7a2f-45b5-bce7-42706751d12e", "responseUserId": "9b501158-f4eb-48ba-823e-7d88b80b7127" }
Description

Description:

  • Get a specific post information by Id

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
id(Required)post PKstringParameter

Request interface:

interface AuthHeader {
    authorization: string;
}

interface ChatBasicDto {
    id: string;
}

type Request = ChatBasicDto & AuthHeader;

Response interface:

type Response<ChatRoom>;


Headers
KeyValueDescription
service-nameone-piece-chat
URL Variables
KeyValueDescription
id1d4118de-a928-4f8e-9333-c647ba52793f
Headers
KeyValueDescription
service-nameone-piece-chat
Description

Description:

  • Get a specific post information by Id

Parameter in Get Pages Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
take(Optional)Page size in a scrollnumberQuery
skip(Optional)Page number for scrollnumberQuery
keyword(Optional)Keyword Search (This MVP doesn’t support)stringQuery
sort(Optional)sort‘ASC’ or ‘DESC’Query

Request interface:

interface AuthHeader {
    authorization: string;
}

interface IPage {
    take?: number;
    skip?: number;
}

interface ISearch extends IPage {
    keyword?: string;
    sort?: TSort;
    [futureKey: string]: any;
}

type Request = ISearch & AuthHeader;

Response

interface PagingResponse {
    chatrooms: ChatRoom[];
    take: number;
    skip: number;
    count: number;
}

type Response<PagingResponse>;


Headers
KeyValueDescription
service-nameone-piece-chat
Description

Description:

  • Receive Chat Read Status Update Event With Socket

Response interface:

interface SocketEventResponse {
    type: EChatRoomSocketEvent.UPDATEREADSTATUSMSG;
    data: ChatRoom;
}

type Response<SocketEventResponse>;


Headers
KeyValueDescription
service-nameone-piece-chat
Query
KeyValueDescription
accessToken{{token}}
Description

Description:

  • Receive Chat Send Status Update Event with Socket

Response interface:

interface SocketEventResponse {
    type: EChatRoomSocketEvent.UPDATESENDSTATUSMSG;
    data: ChatRoom;
}

type Response<SocketEventResponse>;


Headers
KeyValueDescription
service-nameone-piece-chat
Query
KeyValueDescription
accessToken{{token}}
Description

Description:

  • Receive New Chat Room Event with Socket

Response interface:

interface SocketEventResponse {
    type: EChatRoomSocketEvent.NEWCHATMESSAGE;
    data: Chat;
}

type Response<SocketEventResponse>;


Headers
KeyValueDescription
service-nameone-piece-chat
Query
KeyValueDescription
accessToken{{token}}
Description

Description:

  • Receive New Chat Room Event with Socket

Response interface:

interface SocketEventResponse {
    type: EChatRoomSocketEvent.CREATECHATROOM;
    data: ChatRoom;
}

type Response<SocketEventResponse>;


Headers
KeyValueDescription
service-nameone-piece-chat
Query
KeyValueDescription
accessToken{{token}}
Description

Description:

  • Update Chat Read Status With Socket

Request interface:

interface SocketEventData {
    readStatus: EChatStatus,
    participateId: string;
    requestUserId: string;
    chatId: string;
}

interface SocketEvent {
    type: "updatereadstatus",
    data: SocketEventData
}

type Request = SocketEvent;


Headers
KeyValueDescription
service-nameone-piece-chat
Query
KeyValueDescription
accessToken{{token}}
Description

Description:

  • Update Chat Send Status With Socket

Request interface:

interface SocketEventData {
    sendStatus: EChatSendStatus,
    participateId: string;
    requestUserId: string;
    chatId: string;
}

interface SocketEvent {
    type: "updatesendstatus",
    data: SocketEventData
}

type Request = SocketEvent;


Headers
KeyValueDescription
service-nameone-piece-chat
Query
KeyValueDescription
accessToken{{token}}
Description

Description:

  • Update Chat Read Status (Admin Only, for UI use socket)

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
requestUserId(Required)Person who create the chatroomstringBody
readStatus(Required)Chat Status enumerateEnumerateBody

Request interface:

interface AuthHeader {
    authorization: string;
}

interface UpdateChatReadStatusDto {
    requestUserId: string;
    readStatus: EChatStatus;
}

type Request = UpdateChatReadStatusDto & AuthHeader;

Response interface:

type Response<Chat>;


Headers
KeyValueDescription
service-nameone-piece-chat
Content-Typeapplication/json
URL Variables
KeyValueDescription
id42e5f423-0ed0-432a-831b-69c0042b6b23
Body
{ "requestUserId": "735ca6d1-7a2f-45b5-bce7-42706751d12e", "readStatus": "read" }
Description

Description:

  • Update Chat Send Status (Admin Only, for UI use socket)

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
requestUserId(Required)Person who create the chatroomstringBody
sendStatus(Required)Chat Status enumerateEnumerateBody

Request interface:

interface AuthHeader {
    authorization: string;
}

interface UpdateChatSendStatusDto {
    requestUserId: string;
    sendStatus: EChatSendStatus;
}

type Request = UpdateChatSendStatusDto & AuthHeader;

Response interface:

type Response<Chat>;


Headers
KeyValueDescription
service-nameone-piece-chat
Content-Typeapplication/json
URL Variables
KeyValueDescription
id42e5f423-0ed0-432a-831b-69c0042b6b23
Body
{ "requestUserId": "735ca6d1-7a2f-45b5-bce7-42706751d12e", "sendStatus": "finish" }

Locations 7

Base Interface

interface Base {
    createdAt: Date;
    updatedAt: Date;
}

Enumerate

enum ELocationType {
    'COUNTRY' = 'country',
    'CITY' = 'city',
    'SCENE' = 'scene',
    'PORT' = 'port',
    'TURN' = 'turn',
}

enum EUserRole {
    'TRIAL' = 'trial',
    'USER' = 'user',
    'VIP1' = 'vip1',
    'VIP2' = 'vip2',
    'ADMIN' = 'admin',
}

enum EUserGender {
    'MALE' = 'male',
    'FEMALE' = 'female',
}

Geo Interface

type Position = number[];
type GeoJsonTypes = | 
    "Point" | 
    "MultiPoint" | 
    "LineString" |
    "MultiLineString" | 
    "Polygon" | 
    "MultiPolygon" |
    "GeometryCollection";
type BBox = [number, number, number, number] | [number, number, number, number, number, number];

export type GeometryObject = Geometry;

interface GeoJsonObject {
    type: GeoJsonTypes;
    bbox?: BBox;
}

interface MultiLineString extends GeoJsonObject {
    type: "MultiLineString";
    coordinates: Position[][];
}

interface LineString extends GeoJsonObject {
    type: "LineString";
    coordinates: Position[];
}

interface Point extends GeoJsonObject {
    type: "Point";
    coordinates: Position;
}

Location Interface

interface Location extends Base {
    id: string;
    point: Point;
    pointSrid: Point;
    lat: number;
    lon: number;
    type: ELocationType;
    locationName: string;
    country?: Country;
    startTrips?: Trip[];
    endTrips?: Trip[];
    version: number;
}

Country Interface

interface Country extends Base {
    id: string;
    name: string;
    code: string;
}

Turn Interface

interface Turn extends Base {
    id: string;
    name: string;
    geom: LineString;
    srid: LineString;
    length?: number;
    fromnode?: number;
    tonode?: number;
    version: number;
}

User Interface

interface User extends Base {
    id: string;
    role: EUserRole;
    expiredDate: Date;
    diamondCoin: number; // default 0
    goldCoin: number; // default 10
    username: string;
    email: string;
    status: boolean; // default true
    gender?: EUserGender
    age?: number;
    desc?: string;
    profileImage?: string;
    version: number;
}
Description

Description:

  • Get a specific location information by Id

Parameter in Get Location Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
id(Required)location PKstringParameter

Request

interface AuthHeader {
    authorization: string;
}

interface GetLocationById {
  id: string;
}

type Request = GetLocationById & AuthHeader;

Response

type Response<Location>;


Headers
KeyValueDescription
service-nameone-piece-location
URL Variables
KeyValueDescription
id5f866e41-2ba1-47dc-899f-2e9f044d18e9
Headers
KeyValueDescription
service-nameone-piece-location
Query
KeyValueDescription
startLocationNameST. MARY'S (SCILLY ISL.)
endLocationNameMILLHAVEN
typetext
Headers
KeyValueDescription
service-nameone-piece-location
Query
KeyValueDescription
startLocationNameST. MARY'S (SCILLY ISL.)
endLocationNameMILLHAVEN
Headers
KeyValueDescription
service-nameone-piece-location
Query
KeyValueDescription
startNode3555

fromNode

endNode26349

toNode

typetext
Description

Description:

  • Health Check Pinging

Request interface:

Response interface:

type HealthIndicatorStatus = 'up' | 'down';
type HealthCheckStatus = 'error' | 'ok' | 'shutting_down';
type HealthIndicatorResult = {
    /**
     * The key of the health indicator which should be uniqe
     */
    [key: string]: {
        /**
         * The status if the given health indicator was successful or not
         */
        status: HealthIndicatorStatus;
        /**
         * Optional settings of the health indicator result
         */
        [optionalKeys: string]: any;
    };
};

interface HealthCheckResult {
    /**
     * The overall status of the Health Check
     */
    status: HealthCheckStatus;
    /**
     * The info object contains information of each health indicator
     * which is of status "up"
     */
    info?: HealthIndicatorResult;
    /**
     * The error object contains information of each health indicator
     * which is of status "down"
     */
    error?: HealthIndicatorResult;
    /**
     * The details object contains information of every health indicator.
     */
    details: HealthIndicatorResult;
}

type Response<HealthCheckResult>;


Headers
KeyValueDescription
service-nameone-piece-location
Description

Description:

  • Search location information with Paging and support with lat and lon search

Parameter in Locations Paging Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
take(Optional)Page size in a scrollnumberQuery
skip(Optional)Page numbernumberQuery
lat(Required)Port latitudenumberQuery
lon(Required)Port country namenumberQuery
method(Required)search method‘specific’ or ‘range’Query
range(Optional)given range for search only when search method is rangenumberQuery

Request interface:

enum ELocationCoordQueryMethod {
  'SPECIFIC' = 'specific',
  'RANGE' = 'range',
}

interface AuthHeader {
    authorization: string;
}

interface IPage {
  take?: number;
  skip?: number;
}

interface ISearch extends IPage {
  lat: number;
  lon: number;
  method: ELocationCoordQueryMethod;
  range?: number;
}

type Request = ISearch & AuthHeader;

Response interface:

interface PagingResponse {
    locations: Location[];
    take: number;
    skip: number;
    count: number;
}

type Response<PagingResponse>;


Headers
KeyValueDescription
service-nameone-piece-location
Query
KeyValueDescription
lat44.35
lon143.35
methodrange
range2.2
Description

Description:

  • Search location information with Paging

Parameter in Locations Paging Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
take(Optional)Page size in a scrollnumberQuery
skip(Optional)Page numbernumberQuery
locationName(Optional)Port namestringQuery
countryName(Optional)Port country namestringQuery
sort(Optional)sort‘ASC’ or ‘DESC’Query

Request interface:

interface AuthHeader {
    authorization: string;
}

interface IPage {
  take?: number;
  skip?: number;
}

interface ISearch extends IPage {
  keyword?: string;
  sort?: TSort;
  locationName?: string;
  countryName?: string;
  [futureKey: string]: any;
}

type Request = ISearch & AuthHeader;

Response interface:

interface PagingResponse {
    locations: Location[];
    take: number;
    skip: number;
    count: number;
}
type Response<PagingResponse>;


Headers
KeyValueDescription
service-nameone-piece-location
Query
KeyValueDescription
locationNameMOMBETSUsdfsdf
take100

Posts 4

Base Interface

interface Base {
    createdAt: Date;
    updatedAt: Date;
}

Enumerate

enum ETripView {
    'PUBLIC' = 'public',
    'FRIEND' = 'friend',
    'SELF' = 'self',
}

enum ELocationType {
    'COUNTRY' = 'country',
    'CITY' = 'city',
    'SCENE' = 'scene',
    'PORT' = 'port',
    'TURN' = 'turn',
}

enum EUserRole {
    'TRIAL' = 'trial',
    'USER' = 'user',
    'VIP1' = 'vip1',
    'VIP2' = 'vip2',
    'ADMIN' = 'admin',
}

enum EUserGender {
    'MALE' = 'male',
    'FEMALE' = 'female',
}

Post Interface

interface Post extends Base {
    id: string;
    content: string;
    images: string;
    publicStatus: ETripView;
    publisher: User;
    likeUsers: User[];
    trip: Trip;
    version: number;
}

Geo Interface

type Position = number[];
type GeoJsonTypes = | 
    "Point" | 
    "MultiPoint" | 
    "LineString" |
    "MultiLineString" | 
    "Polygon" | 
    "MultiPolygon" |
    "GeometryCollection";
type BBox = [number, number, number, number] | [number, number, number, number, number, number];

export type GeometryObject = Geometry;

interface GeoJsonObject {
    type: GeoJsonTypes;
    bbox?: BBox;
}

interface MultiLineString extends GeoJsonObject {
    type: "MultiLineString";
    coordinates: Position[][];
}

interface Point extends GeoJsonObject {
    type: "Point";
    coordinates: Position;
}

Trip Interface

interface Trip extends Base {
    id: string;
    startDate: Date;
    endDate: Date;
    publicStatus: ETripView;
    companyName?: string;
    shipNumber?: string;
    geom?: MultiLineString;
    publisher: User;
    viewers: User[];
    startPoint: Location;
    endPoint: Location;
    version: number;
}

Location Interface

interface Location extends Base {
    id: string;
    point: Point;
    pointSrid: Point;
    lat: number;
    lon: number;
    type: ELocationType;
    locationName: string;
    country?: Country;
    startTrips?: Trip[];
    endTrips?: Trip[];
    version: number;
}

Country Interface

interface Country extends Base {
    id: string;
    name: string;
    code: string;
}

User Interface

interface User extends Base {
    id: string;
    role: EUserRole;
    expiredDate: Date;
    diamondCoin: number; // default 0
    goldCoin: number; // default 10
    username: string;
    email: string;
    status: boolean; // default true
    gender?: EUserGender
    age?: number;
    desc?: string;
    profileImage?: string;
    trips: Trip[];
    views: Trip[];
    posts: Post[];
    likePosts: Post[];
    followers: User[];
    followings: User[];
    blockLists: User[];
    followerCount: number;
    followingCount: number;
    version: number;
}
Description

Description:

  • Create a new post

Parameter in Create Post Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
content(Required)Post contentstringBody
publicStatus(Required)Status of the trip default with public‘public’ or ‘friend’ or ‘self’Body
tripId(Required)Related to which tripstringBody
publisherId(Required)Who publish this tripstringBody
files(Optional)Post ImagesITrip.BufferedFile[]Body

Request interface:

enum ETripView {
    'PUBLIC' = 'public',
    'FRIEND' = 'friend',
    'SELF' = 'self',
}

interface AuthHeader {
    authorization: string;
}

interface BufferedFile {
    fieldname: string;
    originalname: string;
    encoding: string;
    mimetype: AppMimeType;
    size: number;
    buffer: Buffer | string;
}

interface CreatePostDto {
    content: string;
    publicStatus: ETripView;
    tripId: string;
    publisherId: string;
    files: ITrip.BufferedFile[];
}

type Request = CreatePostDto & AuthHeader;

Response interface:

type Response<Post>;


Headers
KeyValueDescription
service-nameone-piece-trip
Body
KeyValueDescription
files
contentlib test
publicStatuspublic
tripId45311399-d318-4858-a960-2c9f549dc677
publisherId735ca6d1-7a2f-45b5-bce7-42706751d12e
Description

Description:

  • Get a specific post information by Id

Parameter in Get Post Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
id(Required)post PKstringParameter

Request interface:

interface AuthHeader {
    authorization: string;
}

interface PostBasicDto {
    id: string;
}

type Request = PostBasicDto & AuthHeader;

Response

type Response<Post>;


Headers
KeyValueDescription
service-nameone-piece-trip
URL Variables
KeyValueDescription
postIde76565bd-99f7-42d8-98c5-0dd173ef8e08
Description

Description:

  • Search post information with paging

Parameter in Posts Paging Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
take(Optional)Page size in a scrollnumberQuery
skip(Optional)Page number for scrollnumberQuery
keyword(Optional)Keyword Search (This MVP doesn’t support)stringQuery
sort(Optional)sort‘ASC’ or ‘DESC’Query

Request interface:

interface AuthHeader {
    authorization: string;
}

interface IPage {
    take?: number;
    skip?: number;
}

interface ISearch extends IPage {
    keyword?: string;
    sort?: TSort;
    [futureKey: string]: any;
}

type Request = ISearch & AuthHeader;

Response interface:

interface PagingResponse {
    posts: Post[];
    take: number;
    skip: number;
    count: number;
}

type Response<PagingResponse>;


Headers
KeyValueDescription
service-nameone-piece-trip

User 16

Base Interface

interface Base {
    createdAt: Date;
    updatedAt: Date;
}

Enumerate

enum ETripView {
    'PUBLIC' = 'public',
    'FRIEND' = 'friend',
    'SELF' = 'self',
}

enum EUserRole {
    'TRIAL' = 'trial',
    'USER' = 'user',
    'VIP1' = 'vip1',
    'VIP2' = 'vip2',
    'ADMIN' = 'admin',
}

enum EUserGender {
    'MALE' = 'male',
    'FEMALE' = 'female',
}

User Interface

interface User extends Base {
    id: string;
    role: EUserRole;
    expiredDate: Date;
    diamondCoin: number; // default 0
    goldCoin: number; // default 10
    username: string;
    email: string;
    status: boolean; // default true
    gender?: EUserGender
    age?: number;
    desc?: string;
    profileImage?: string;
    trips: Trip[];
    views: Trip[];
    posts: Post[];
    likePosts: Post[];
    followers: User[];
    followings: User[];
    blockLists: User[];
    followerCount: number;
    followingCount: number;
    version: number;
}

Trip Interface

interface Trip extends Base {
    id: string;
    startDate: Date;
    endDate: Date;
    publicStatus: ETripView;
    companyName?: string;
    shipNumber?: string;
    publisher: User;
    viewers: User[];
    version: number;
}

Post Interface

interface Post extends Base {
    id: string;
    content: string;
    images: string;
    publicStatus: ETripView;
    publisher: User;
    likeUsers: User[];
    trip: Trip;
    version: number;
}
Description

Description:

  • Step 3 of the forget passowrd process, user has to provide the verify key and new password in the UI of the app.

Parameter in forget password step 3:

ParameterDescriptionTypeIn
key(Required)verify keystringbody
password(Required)user passwordstringbody

Request interface:

interface FPStep3 {
    key: string;
    passowrd: string;
}

type Request = FPStep3;

Response interface:

export type Response<string>;


Headers
KeyValueDescription
service-nameone-piece-user
Content-Typeapplication/json
Body
{ "key": "XiGEFy", "password": "Labc1234" }
Description

Description:

  • Step 1 of the forget passowrd process, when user forget their password they can hit this endpoint with email to get a verify email

Parameter in lforget password step 1:

ParameterDescriptionTypeIn
email(Required)user emailstringbody

Request interface:

interface FPStep1 {
    email: string;
}

type Request = FPStep1;

Response interface:

type Response<string>;


Headers
KeyValueDescription
service-nameone-piece-user
Content-Typeapplication/json
Body
{ "email": "dreak603@gmail.com" }
Description

Description:

  • Step 2 of the forget passowrd process, user has to provide the verify key in the UI of the app.

Parameter in forget password step 2:

ParameterDescriptionTypeIn
key(Required)verify keystringbody

Request interface:

interface FPStep2 {
    key: string;
}

type Request = FPStep2;

Response interface:

type Response<string>;


Headers
KeyValueDescription
service-nameone-piece-user
Content-Typeapplication/json
Body
{ "key": "XiGEFy" }
Description

Description:

  • Get a specific user information with token

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader

Request Interface:

interface AuthHeader {
    authorization: string;
}

type Request = AuthHeader;

Response Interface:

interface IUserInfo {
    id: string;
    role: "trial" | "user" | "vip1" | "vip2" | "admin",
    username: string;
    licence: "onepiece",
    email: string;
    expiredDate: string;
}

interface UserInformation {
    user: IUserInfo;
}

type Response<UserInformation>;


Headers
KeyValueDescription
service-nameone-piece-user
Description

Description:

  • Get a specific user information with token

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
id(Required)User PKstringParameter

Request Interface:

interface AuthHeader {
    authorization: string;
}

interface UserIdDto {
    id: string;
}

type Request = UserIdDto & AuthHeader;

Response Interface:

type Response<User>;


Headers
KeyValueDescription
service-nameone-piece-user
URL Variables
KeyValueDescription
id735ca6d1-7a2f-45b5-bce7-42706751d12e
Description

Description:

  • Get a specific user information with token

Parameter in Get Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
interface ResponseBase {
  statusCode: number;
  status: 'error' | 'success';
  message: any;
  [futureKey: string]: any;
}

export type Response = ResponseBase;


Headers
KeyValueDescription
service-nameone-piece-user
Description

Description:

  • Get user information with pagination.

Parameter in Get user information with pagination:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
takes(Optional)Offset (paginated) - where from entities should be taken.numberQuery
skip(Optional)Limit (paginated) - max number of entities should be taken.numberQuery
keyword(Optional)Keyword searching specifc with username onlystringQuery
sort(Optional)sort‘ASC’ or ‘DESC’Query

Request

interface IPage {
  take?: number;
  skip?: number;
}

interface ISearch extends IPage {
  keyword?: string;
  sort?: TSort;
  [futureKey: string]: any;
}
type Request = ISearch;

Response

interface ResponseMessage {
    user: User[];
    take: number;
    skip: number;
    count: number;
}

type Response<ResponseMessage>;


Headers
KeyValueDescription
service-nameone-piece-user
Description

Description:

  • Login with Facebook Oauth2.0

Request Interface:

Response Interface:

interface FacebookCallbackInfo {
    email: string;
    username: string;
    picture: string;
    accessToken: string;
    id: string;
}

interface UserInformation {
    user: FacebookCallbackInfo;
}

type Response<UserInformation>;


Headers
KeyValueDescription
service-nameone-piece-user
Description

Description:

  • Login with Google Oauth2.0

Request Interface:

Response Interface:

interface GoogleCallbackInfo {
    email: string;
    username: string;
    picture: string;
    accessToken: string;
    id: string;
}

interface UserInformation {
    user: GoogleCallbackInfo;
}

type Response<UserInformation>;


Headers
KeyValueDescription
service-nameone-piece-user
Description

Description:

  • Signin a user.

Parameter in Signin user:

ParameterDescriptionTypeIn
email(Required)email of the userstringbody
password(Required)password of the userstringbody

Request interface:

interface SignInDto {
    email: string;
    password: string;
}

type Request = SignInDto;

Response interface:

type Response<string>;


Headers
KeyValueDescription
service-nameone-piece-user
Content-Typeapplication/json
Body
{ "email": "lib@gmail.com", "password": "Aabc1234" }
Description

Description:

  • Signup a user.

Parameter in Signup user:

ParameterDescriptionTypeIn
username(Required)name of the userstringbody
email(Required)email of the userstringbody
password(Required)password of the userstringbody

Request interface:

interface SignUpDto {
    username: string;
    email: string;
    password: string;
}

type Request = SignUpDto;

Response interface:

type Response<string>;


Headers
KeyValueDescription
service-nameone-piece-user
Content-Typeapplication/json
Body
{ "username": "libtest", "email": "lib@gmail.com", "password": "Aabc1234" }
Description

Description:

  • Soft delete a specific user information with token

Parameter in Soft Delete User:

ParameterDescriptionTypeIn
id(Required)Primary Key of the userstringParam
authorization(Required)JWT TokenstringHeader

Request Interface:

interface AuthHeader {
    authorization: string;
}

interface DeleteById {
    id: string;
}

type Request = DeleteById & AuthHeader;

Response Interface:

export type Response<unknown>;


Headers
KeyValueDescription
service-nameone-piece-user
URL Variables
KeyValueDescription
id58c617e8-9ff7-467d-b311-90a32baa9722
Description

Description:

  • Update a specific user additional Information

Parameter

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
oldPassword(Required) .old passwordstringbody
newPassword(Required) .new passwordstringbody

Request

enum EUserGender {
    'MALE' = 'male',
    'FEMALE' = 'female',
}

interface BufferedFile {
    fieldname: string;
    originalname: string;
    encoding: string;
    mimetype: AppMimeType;
    size: number;
    buffer: Buffer | string;
}

interface UpdateUserAdditionalInfoDto {
    gender?: EUserGender;
    age?: number;
    desc?: number;
}

interface UpdateUserAdditionalInfoInServerDto extends UpdateUserAdditionalInfoDto {
  files?: BufferedFile[];
}

type Request = UpdateUserAdditionalInfoInServerDto;

Response

type Response<User>;


Headers
KeyValueDescription
service-nameone-piece-user
URL Variables
KeyValueDescription
id{{user_id}}
Body
KeyValueDescription
gendermale
Description

Description:

  • Update a specific user password with token

Parameter in Update a specific user password with token:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
oldPassword(Required) .old passwordstringbody
newPassword(Required) .new passwordstringbody
interface ResponseBase {
  statusCode: number;
  status: 'error' | 'success';
  message: any;
  [futureKey: string]: any;
}

export type Response = ResponseBase;


Headers
KeyValueDescription
service-nameone-piece-user
Content-Typeapplication/json
URL Variables
KeyValueDescription
idc56df50b-2a37-4b7a-aab7-3443843c4a70
Body
{ "role": "vip2", "subRange": 5 }
Description

Description:

  • Update a specific user password with token

Parameter in Update a specific user password with token:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
oldPassword(Required) .old passwordstringbody
newPassword(Required) .new passwordstringbody

Request Interface:

interface AuthHeader {
    authorization: string;
}

interface UpdatePassword {
    oldPassword: string;
    newPassword: string;
}

export type Request = UpdatePassword & AuthHeader;

Response Interface:

type Response<string>;


Headers
KeyValueDescription
service-nameone-piece-user
Content-Typeapplication/json
URL Variables
KeyValueDescription
id{{user_id}}
Body
{ "oldPassword": "Cabc1234", "newPassword": "Dabc1234" }
Description

Description:

  • Logout a specific user with token

Parameter in logout Use Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader

Request Interface:

interface AuthHeader {
    authorization: string;
}

type Request = AuthHeader;

Response Interface:

type Response<string>;


Headers
KeyValueDescription
service-nameone-piece-user

trips 4

Base Interface

interface Base {
    createdAt: Date;
    updatedAt: Date;
}

Enumerate

enum ETripView {
    'PUBLIC' = 'public',
    'FRIEND' = 'friend',
    'SELF' = 'self',
}

enum ELocationType {
    'COUNTRY' = 'country',
    'CITY' = 'city',
    'SCENE' = 'scene',
    'PORT' = 'port',
    'TURN' = 'turn',
}

enum EUserRole {
    'TRIAL' = 'trial',
    'USER' = 'user',
    'VIP1' = 'vip1',
    'VIP2' = 'vip2',
    'ADMIN' = 'admin',
}

enum EUserGender {
    'MALE' = 'male',
    'FEMALE' = 'female',
}

Post Interface

interface Post extends Base {
    id: string;
    content: string;
    images: string;
    publicStatus: ETripView;
    publisher: User;
    likeUsers: User[];
    trip: Trip;
    version: number;
}

Geo Interface

type Position = number[];
type GeoJsonTypes = | 
    "Point" | 
    "MultiPoint" | 
    "LineString" |
    "MultiLineString" | 
    "Polygon" | 
    "MultiPolygon" |
    "GeometryCollection";
type BBox = [number, number, number, number] | [number, number, number, number, number, number];

export type GeometryObject = Geometry;

interface GeoJsonObject {
    type: GeoJsonTypes;
    bbox?: BBox;
}

interface MultiLineString extends GeoJsonObject {
    type: "MultiLineString";
    coordinates: Position[][];
}

interface Point extends GeoJsonObject {
    type: "Point";
    coordinates: Position;
}

Trip Interface

interface Trip extends Base {
    id: string;
    startDate: Date;
    endDate: Date;
    publicStatus: ETripView;
    companyName?: string;
    shipNumber?: string;
    geom?: MultiLineString;
    publisher: User;
    viewers: User[];
    startPoint: Location;
    endPoint: Location;
    version: number;
}

Location Interface

interface Location extends Base {
    id: string;
    point: Point;
    pointSrid: Point;
    lat: number;
    lon: number;
    type: ELocationType;
    locationName: string;
    country?: Country;
    startTrips?: Trip[];
    endTrips?: Trip[];
    version: number;
}

Country Interface

interface Country extends Base {
    id: string;
    name: string;
    code: string;
}

User Interface

interface User extends Base {
    id: string;
    role: EUserRole;
    expiredDate: Date;
    diamondCoin: number; // default 0
    goldCoin: number; // default 10
    username: string;
    email: string;
    status: boolean; // default true
    gender?: EUserGender
    age?: number;
    desc?: string;
    profileImage?: string;
    trips: Trip[];
    views: Trip[];
    posts: Post[];
    likePosts: Post[];
    followers: User[];
    followings: User[];
    blockLists: User[];
    followerCount: number;
    followingCount: number;
    version: number;
}
Description

Description:

  • Create a new trip

Parameter in Create Trip Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
startDate(Required)When the trip start with ISO FormatstringBody
endDate(Required)When the trip end with ISO FormatstringBody
publisherId(Required)Who publish this tripstringBody
startPointName(Required)Which port startsstringBody
endPointName(Required)Which port endsstringBody
publicStatus(Required)Status of the trip default with public‘public’ or ‘friend’ or ‘self’Body
companyName(Optional)Which company do they belongs tostringBody
shipNumber(Optional)What is the their ship numberstringBody

Request interface:

interface AuthHeader {
    authorization: string;
}

interface CreateTripDto {
    startDate: string;
    endDate: string;
    publisherId: string;
    startPointName: string;
    endPointName: string;
    publicStatus: ETripView;
    companyName?: string;
    shipNumber?: string;
}

type Request = CreateTripDto & AuthHeader;

Response interface:

type Response<Trip>;


Headers
KeyValueDescription
service-nameone-piece-trip
Content-Typeapplication/json
Body
{ "startDate": "2021-02-14T06:07:41.624Z", "endDate": "2021-03-28T16:00:00.000Z", "publisherId": "72af76ec-bdb8-42cf-914e-003af1ce7d09", "startPointName": "ST. MARY'S (SCILLY ISL.)", "endPointName": "MILLHAVEN", "publicStatus": "public" }
Description

Description:

  • Get a specific trip information by Id

Parameter in Get Trip Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
id(Required)trip PKstringParameter
publisherId(Required)user PKstringParameter

Request

interface AuthHeader {
    authorization: string;
}

interface TripBasicDto {
    id: string;
}

interface GetTripByIdDto extends TripBasicDto {
    publisherId: string;
}

type Request = GetTripByIdDto & AuthHeader;

Response interface:

type Response<Trip>;


Headers
KeyValueDescription
service-nameone-piece-trip
URL Variables
KeyValueDescription
id45311399-d318-4858-a960-2c9f549dc677
publisherId735ca6d1-7a2f-45b5-bce7-42706751d12e
Description

Description:

  • Get a specific trip information by Paging

Parameter in Trips Paging Info:

ParameterDescriptionTypeIn
authorization(Required)JWT TokenstringHeader
take(Optional)Page size in a scrollnumberQuery
skip(Optional)Page number for scrollnumberQuery
publisherId(Optional)User PKnumberQuery
keyword(Optional)Keyword Search (This MVP doesn’t support)stringQuery
sort(Optional)sort‘ASC’ or ‘DESC’Query

Request interface:

interface AuthHeader {
    authorization: string;
}

interface IPage {
  take?: number;
  skip?: number;
}

interface ISearch extends IPage {
  keyword?: string;
  sort?: TSort;
  [futureKey: string]: any;
}

interface GetTripByPagingDto extends ISearch {
    publisherId: string;
}

type Request = GetTripByPagingDto & AuthHeader;

Response interface:

interface PagingResponse {
    trips: Trip[],
    take: number;
    skip: number;
    count: number;
}

type Response<PagingResponse>;


Headers
KeyValueDescription
service-nameone-piece-trip
Query
KeyValueDescription
publisherId735ca6d1-7a2f-45b5-bce7-42706751d12e