Search in sources :

Example 1 with PkgVersionType

use of org.haiku.haikudepotserver.api1.model.PkgVersionType in project haikudepotserver by haiku.

the class UserRatingApiImpl method createUserRating.

@Override
public ResponseEntity<CreateUserRatingResponseEnvelope> createUserRating(@Valid CreateUserRatingRequestEnvelope createUserRatingRequestEnvelope) {
    CreateUserRatingRequest requestV1 = new CreateUserRatingRequest();
    requestV1.repositoryCode = createUserRatingRequestEnvelope.getRepositoryCode();
    requestV1.naturalLanguageCode = createUserRatingRequestEnvelope.getNaturalLanguageCode();
    requestV1.userNickname = createUserRatingRequestEnvelope.getUserNickname();
    requestV1.userRatingStabilityCode = createUserRatingRequestEnvelope.getUserRatingStabilityCode();
    requestV1.comment = createUserRatingRequestEnvelope.getComment();
    requestV1.rating = Optional.ofNullable(createUserRatingRequestEnvelope.getRating()).map(Number::shortValue).orElse(null);
    requestV1.pkgName = createUserRatingRequestEnvelope.getPkgName();
    requestV1.pkgVersionArchitectureCode = createUserRatingRequestEnvelope.getPkgVersionArchitectureCode();
    requestV1.pkgVersionMajor = createUserRatingRequestEnvelope.getPkgVersionMajor();
    requestV1.pkgVersionMinor = createUserRatingRequestEnvelope.getPkgVersionMinor();
    requestV1.pkgVersionMicro = createUserRatingRequestEnvelope.getPkgVersionMicro();
    requestV1.pkgVersionPreRelease = createUserRatingRequestEnvelope.getPkgVersionPreRelease();
    requestV1.pkgVersionRevision = createUserRatingRequestEnvelope.getPkgVersionRevision();
    requestV1.pkgVersionType = Optional.ofNullable(createUserRatingRequestEnvelope.getPkgVersionType()).map(pvt -> PkgVersionType.valueOf(pvt.name())).orElse(null);
    org.haiku.haikudepotserver.api1.model.userrating.CreateUserRatingResult resultV1 = userRatingApiV1.createUserRating(requestV1);
    return ResponseEntity.ok(new CreateUserRatingResponseEnvelope().result(new CreateUserRatingResult().code(resultV1.code)));
}
Also used : org.haiku.haikudepotserver.api1.model.userrating(org.haiku.haikudepotserver.api1.model.userrating) CreateUserRatingResult(org.haiku.haikudepotserver.api2.model.CreateUserRatingResult)

Aggregations

org.haiku.haikudepotserver.api1.model.userrating (org.haiku.haikudepotserver.api1.model.userrating)1 CreateUserRatingResult (org.haiku.haikudepotserver.api2.model.CreateUserRatingResult)1