tvpl.api

<back to all web services

UserByDepartmentsRequest

Tìm kiếm người dùng theo theo nhiều phòng ban

Requires Authentication
The following routes are available for this service:
GET/users/by-departmentIds
import 'package:servicestack/servicestack.dart';

class PagingRequest implements IConvertible
{
    int? page;
    int? limit;

    PagingRequest({this.page,this.limit});
    PagingRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        page = json['page'];
        limit = json['limit'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'page': page,
        'limit': limit
    };

    getTypeName() => "PagingRequest";
    TypeContext? context = _ctx;
}

/**
* Tìm kiếm người dùng theo theo nhiều phòng ban
*/
class UserByDepartmentsRequest extends PagingRequest implements IConvertible
{
    String? userName;
    List<int>? departmentIds;

    UserByDepartmentsRequest({this.userName,this.departmentIds});
    UserByDepartmentsRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        userName = json['userName'];
        departmentIds = JsonConverters.fromJson(json['departmentIds'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'userName': userName,
        'departmentIds': JsonConverters.toJson(departmentIds,'List<int>',context!)
    });

    getTypeName() => "UserByDepartmentsRequest";
    TypeContext? context = _ctx;
}

enum CategoryTypes
{
    Department,
    PartyGroup,
    DocGroup,
    DocType,
    IssuingAgency,
    Status,
    Subjects,
    Workflow,
}

class CreateCategoryModel implements IConvertible
{
    String? name;
    String? description;
    CategoryTypes? type;
    bool? isParty;
    // @ignore()
    List<int>? childList;

    CreateCategoryModel({this.name,this.description,this.type,this.isParty,this.childList});
    CreateCategoryModel.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        description = json['description'];
        type = JsonConverters.fromJson(json['type'],'CategoryTypes',context!);
        isParty = json['isParty'];
        childList = JsonConverters.fromJson(json['childList'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name,
        'description': description,
        'type': JsonConverters.toJson(type,'CategoryTypes',context!),
        'isParty': isParty,
        'childList': JsonConverters.toJson(childList,'List<int>',context!)
    };

    getTypeName() => "CreateCategoryModel";
    TypeContext? context = _ctx;
}

class Category extends CreateCategoryModel implements IConvertible
{
    int? id;
    int? level;
    int? sortOrder;
    DateTime? lastUpdate;
    // @ignore()
    List<Category>? children;

    Category({this.id,this.level,this.sortOrder,this.lastUpdate,this.children});
    Category.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        level = json['level'];
        sortOrder = json['sortOrder'];
        lastUpdate = JsonConverters.fromJson(json['lastUpdate'],'DateTime',context!);
        children = JsonConverters.fromJson(json['children'],'List<Category>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'level': level,
        'sortOrder': sortOrder,
        'lastUpdate': JsonConverters.toJson(lastUpdate,'DateTime',context!),
        'children': JsonConverters.toJson(children,'List<Category>',context!)
    });

    getTypeName() => "Category";
    TypeContext? context = _ctx;
}

class BaseResponse<List> implements IResponseRequest, IConvertible
{
    int? code;
    String? message;
    List<Category>? data;

    BaseResponse({this.code,this.message,this.data});
    BaseResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        code = json['code'];
        message = json['message'];
        data = JsonConverters.fromJson(json['data'],'List<Category>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'code': code,
        'message': message,
        'data': JsonConverters.toJson(data,'List<Category>',context!)
    };

    getTypeName() => "BaseResponse<$List`1>";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
    'PagingRequest': TypeInfo(TypeOf.Class, create:() => PagingRequest()),
    'UserByDepartmentsRequest': TypeInfo(TypeOf.Class, create:() => UserByDepartmentsRequest()),
    'CategoryTypes': TypeInfo(TypeOf.Enum, enumValues:CategoryTypes.values),
    'CreateCategoryModel': TypeInfo(TypeOf.Class, create:() => CreateCategoryModel()),
    'Category': TypeInfo(TypeOf.Class, create:() => Category()),
    'List<Category>': TypeInfo(TypeOf.Class, create:() => <Category>[]),
    'BaseResponse<List>': TypeInfo(TypeOf.Class, create:() => BaseResponse<List>()),
});

Dart UserByDepartmentsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /users/by-departmentIds HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	code: 0,
	message: String,
	data: 
	{
		users: 
		[
			{
				id: 0,
				fullName: String,
				email: String,
				departmentId: 0,
				partyGroupId: 0,
				avatar: String,
				telephone: String,
				birthday: "0001-01-01T00:00:00.0000000+07:06",
				createdAt: "0001-01-01T00:00:00.0000000+07:06",
				updatedAt: "0001-01-01T00:00:00.0000000+07:06",
				failedLoginCount: 0,
				roles: 
				[
					0
				],
				lastLoginDate: "0001-01-01T00:00:00.0000000+07:06",
				name: String
			}
		],
		code: 0,
		message: String,
		totalCount: 0
	}
}