PostMapperImpl.java

package org.petify.feed.mapper;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import org.petify.feed.dto.PostRequest;
import org.petify.feed.dto.PostResponse;
import org.petify.feed.model.Post;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2025-06-26T07:25:31+0000",
    comments = "version: 1.6.3, compiler: javac, environment: Java 21.0.7 (Oracle Corporation)"
)
@Component
public class PostMapperImpl implements PostMapper {

    @Override
    public Post toEntity(PostRequest postRequest) {
        if ( postRequest == null ) {
            return null;
        }

        Post post = new Post();

        post.setTitle( postRequest.title() );
        post.setShortDescription( postRequest.shortDescription() );
        post.setMainImageId( postRequest.mainImageId() );
        post.setLongDescription( postRequest.longDescription() );
        post.setFundraisingId( postRequest.fundraisingId() );
        List<Long> list = postRequest.imageIds();
        if ( list != null ) {
            post.setImageIds( new ArrayList<Long>( list ) );
        }

        return post;
    }

    @Override
    public PostResponse toDto(Post post) {
        if ( post == null ) {
            return null;
        }

        Long id = null;
        Long shelterId = null;
        String title = null;
        String shortDescription = null;
        Long mainImageId = null;
        String longDescription = null;
        Long fundraisingId = null;
        List<Long> imageIds = null;
        LocalDateTime createdAt = null;
        LocalDateTime updatedAt = null;

        id = post.getId();
        shelterId = post.getShelterId();
        title = post.getTitle();
        shortDescription = post.getShortDescription();
        mainImageId = post.getMainImageId();
        longDescription = post.getLongDescription();
        fundraisingId = post.getFundraisingId();
        List<Long> list = post.getImageIds();
        if ( list != null ) {
            imageIds = new ArrayList<Long>( list );
        }
        createdAt = post.getCreatedAt();
        updatedAt = post.getUpdatedAt();

        PostResponse postResponse = new PostResponse( id, shelterId, title, shortDescription, mainImageId, longDescription, fundraisingId, imageIds, createdAt, updatedAt );

        return postResponse;
    }
}